i have a select dropdown on a webpage:
<select class="designs" id="color" name="Color">
<option value="">Select Color . . .</option>
<option value="Dark">Dark</option>
<option value="White">White</option>
<option value="Light">Light</option>
</select>
and i am trying to find the right jquery code to select the first entry on that combobox (the one with option value ="" and the text of "Select Color . . ." (this is the setting that is on the page during original load before the user makes any changes)
I am doing this off of a button click link that says "Reset".
You could use the .val()
function. And because the value of the element you want to preselect is empty you pass an empty string:
$('#color').val('');
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