I have a dynamic select box, the way it works is that the appearance of next select box will depend on the selection of previous select box. It is working perfectly for me. My problem is I want to make the name of each select box like this: name of second select box is "<select name=Level_1", third select box is children of second, so the name is: "<select name=Level_2" forth select box is children of third, so the name is: "<select name=Level_3" ... I am not sure how I can achieve that, can anyone give me a hint? thanks in advance
from what i get out of your question my suggestion is to give each select an ID - say, 1,2,3,4 than when you add on onchange with whatever function <select id="1" onchange="somefunction(this.id)"> i think you could probably than change the names with function somefunction(someID) { if (someID == 1) //When the change comes from the first select if (document.getElementById("1").selectedIndex == 1) document.getElementById("2").name = "someNewName" else if (document.getElementById("1").selectedIndex == 2) document.getElementById("2").name = "someNewName" } that's a lot of hardcoded if statements though, i'm sure there are ways to cut down on code depending on what you're actually trying to do
the id of my select is not in order, e.g current one can be 10, next one can be 389, I don't think assigning static id is useful.