I want to know how to select the first option in all select tags on my page using jquery.
tried this:
$('select option:nth(0)').attr("selected", "selected");
But didn’t work
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.
Try this out…
Another option would be this, but it will only work for one drop down list at a time as coded below:
Take a look at this post on how to set based on value, its interesting but won’t help you for this specific issue:
Change the selected value of a drop-down list with jQuery