How to display second dropdown list based on first dropdownlist?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to display second dropdown list based on first dropdownlist??

24th Nov 2017, 3:28 AM
Anjaneyulu Bairi
3 Answers
+ 5
I haven't done it as yet, but I believe there are two ways. First, define all possibilities in HTML with display of false except for the one that states select first one. Once they select the first list, change the true one to false and the currently valid one to true. Second, use JS to modify the list of options by creating new ones as needed once a selection of the first list is done.
24th Nov 2017, 3:41 AM
John Wells
John Wells - avatar
24th Nov 2017, 4:13 AM
Calviղ
Calviղ - avatar
+ 1
I coded both way in this. I'll fill in comments asap, but I figured you should see example of what Calvin didn't code. https://code.sololearn.com/W16sY9vEuIk3/?ref=app
24th Nov 2017, 3:15 PM
John Wells
John Wells - avatar