Reputation: 1779
I am trying to set the selected item of a select which equals a certain value. I am currently using:
$("#mySelectList").val(4);
This however is setting the list to the 4th selectedIndex instead of the selectedIndex which has a value of 4.
I am using version 1.9.1. Thanks for your help!
Upvotes: 0
Views: 233
Reputation: 73896
Try this:
$("#mySelectList option[value='4']").prop('selected', true);
Upvotes: 3