I have a searchbar with a submit and a dropdown option i am appending to that submit. The submit gets appended twice. I tried using "one" instead of "on" which only returned the first submit. the problem is i need it to only return the second submit or best case prevent the first submit from happening. Currently my url looks like this: "/...?search=test&Item=1&Item=3" and i only want the "&item=3" as the first variable doesn't get updated.
var variableToSend = '';
$('#selector').on('click',function() {
variableToSend = $(this).val();
$('form').append('<input type="hidden" id="yourData" name="Item" value="'+ variableToSend +'"/>');
});