I have 5 dependent select boxes, if I want to remove all low-level select boxes when selection of first box is changed, How can I do that? Thanks
something like this? <html> <head> <script type="text/javascript"> function toggle(div){ var d = document.getElementById(div).style.display; if(d=="") { document.getElementById(div).style.display = "none"; } else { document.getElementById(div).style.display = ""; } } </script> </head> <body> <form> toggle <input type="checkbox" id="toggler" onclick="toggle('boxes')" /> <div id="boxes">low-level 1<input type="checkbox" /> <br />low-level 2<input type="checkbox" /> <br />low-level 3<input type="checkbox" /> <br />low-level 4<input type="checkbox" /> <br />low-level 5<input type="checkbox" /></div> </form> </body> </html> Code (markup):
Thanks for the reply. I tried your code, it works quit different than what I am expecting. the 5 select boxes I have are dependent, e.g if I choose the item in first box doesn't have children, then all the low-level select boxes from previous selection will be gone, if I select the item in second box doesn't have children, all his low-level select box will be gone, etc. Thanks again for the help