0

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!

1

1 Answer 1

3

Try this:

$("#mySelectList option[value='4']").prop('selected', true); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.