How do you preselect an option in a multiple select html tag using jquery’s val()?
What I mean by this is that say you have a multiselect component and you want some of the values to be preselected?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming I’ve understood your question correctly, you can pass an array of values to the
.val()method:Here’s a working example.