Reset Dropdown to Blank using Jquery
-
My form has two drop-downs to select who gets the email. Both are hidden until a radio selection is chosen. I need to reset the drop-down selection of the other drop-down when the radio selection changes to avoid sending to two people.
The only place I could see changing after a selections was made was inside
#select2-chosen-1 so I tried resetting that with:jQuery("#select2-chosen-1").text('---');
but that only “appears” to reset it when I send the form two selections are still being processed.
Here’s what I’m using so far.
jQuery('input[type=radio][name=radio-email-location]').change(function() { if (this.value == 'San Jose') { //alert("San Jose Selected"); jQuery('#email-san-jose-wrap').css('display','initial'); jQuery('#email-san-fran-wrap').css('display','none'); jQuery("#select2-chosen-2").text('---'); } else if (this.value == 'San Francisco') { //alert("San Francisco Selected"); jQuery('#email-san-jose-wrap').css('display','none'); jQuery('#email-san-fran-wrap').css('display','initial'); jQuery("#select2-chosen-1").text('---'); } });
- The topic ‘Reset Dropdown to Blank using Jquery’ is closed to new replies.