I want to select first option of all the select dropdowns having class required-entry in a page with Prototype JS. I have searched through SO questions and found many relevant questions but not what I exactly needed.
Thanks
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.
It’s been quite a while since I’ve done any Prototype.js. So this may not be the best way to go about it, but it should work.
let’s say you have a page with:
You can grab the first
optionfor eachselectby doing:Now, I couldn’t tell from your question if you wanted to retrieve the first options, or set the
selectvalue so that the first option is literally selected. Here’s the later: