简体   繁体   中英

div vision toggle from drop down menu

I'm creating a universal text template tool for work and I need a little help with getting the appropriate template to show up when a drop down menu is changed.

I'm using JavaScript, no JQuery for me yet.

The template objects are divs, and they are supposed to change by setting display: none on all but the one the menu has selected.

The problem: The templates (divs) never change.

Fiddle

Thank you for looking!

There are multiple problems with the script.

Problems
1. caseSelect was pointing to the object instead of value ( var caseSelect = document.getElementById("caseType").value; )
2. In the select element all options had the value thing1
3. break statement was missing at the end of each case

Demo: Fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM