Member_2_1242703
asked on
Javascript: Setting a dropdown based on another dropdown selection
I have 2 dropdowns, mySelect and myMins
When a selection is made from mySelect, I want to check and see if it is the last option in the list. If it is, I want to set myMins to the first option and disable it. If not, enable myMins.
How would I do this?
When a selection is made from mySelect, I want to check and see if it is the last option in the list. If it is, I want to set myMins to the first option and disable it. If not, enable myMins.
How would I do this?
ASKER
Ok, this was kind of inline with what I was trying. I think my problem is that mySelect is populated by other selections made by the user.
So this is what the HTML looks like even when filled with selections:
Is there still a way to do this?
So this is what the HTML looks like even when filled with selections:
<select id="mySelect" name="Hour" required="required"></select>
Is there still a way to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic. Thank you!
You are welcome.
https://www.experts-exchange.com/articles/28828/Creating-linked-dropdowns-using-jQuery-and-PHP.html
For your specific requirement you need to attach an event handler to the first drop down
HTML
Open in new window
Open in new window
Working sample here