Reputation: 9157
I want to select all the select elements that have a value of "-1" and change the value to blank aka "".
I want to change all these:
<option value="-1">Select Something</option>
to this:
<option value="">Select Year</option>
I am using this code:
jQuery().ready(function() {
$("option[value='-1']").val('');
});
... which isn't working. Any idea why?
Upvotes: 1
Views: 187
Reputation: 83356
You can select options with a specific value like this:
$("option[value='-1']")
and then set a new value with the val
function:
$("option[value='-1']").val('');
Upvotes: 3