Do I have to iterate through ALL the and set remove the 'selected' attribute or is there a better way?
Simply find all the selected <option>
tags within your <select>
and remove the selected
attribute:
$("#my_select option:selected").removeAttr("selected");
As of jQuery 1.6, you should use .prop
instead of removing the attribute:
$("#my_select option:selected").prop("selected", false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With