Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67527

Dropdown appends form submit twice

$
0
0

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 +'"/>');
    });

Viewing all articles
Browse latest Browse all 67527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>