How do you loop through all html dropdowns and set their values using JavaScript?

lyderslim

New member
My html form has anywhere from 1-100 different dropdown boxes (select / option) depending on what the user is doing. I need an option for the user to select one value and click a button that populates the rest of them with that value -- so they don't have to go down and select each one individually -- especially if there are 100 and they all just need to be the same.

All of the dropdown boxes have a name that start the same. Then I just tack on an identifier. So box 1 would be named "box001" and box 2 is "box002" and so on. So I'd pass the value to the JS function and that function needs to loop through all SELECT boxes that start with "box" and set the value to the passed-in value.
 
Back
Top