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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -