How to set the selected option of a select list by value NOT by selectedIndex using jQuery? -


i trying set selected item of select equals value. using:

$("#myselectlist").val(4); 

this setting list 4th selectedindex instead of selectedindex has value of 4.

i using version 1.9.1. help!

try this:

$("#myselectlist option[value='4']").prop('selected', true); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -