kyleldi Posted March 11, 2009 Share Posted March 11, 2009 I've got a dropdown that is supposed to cue a field to show if the "other" selection is hit, yet it's not working. Where did I go wrong? <body onLoad="document.getElementById('element').style.display='none';"> <script type="text/javascript"> function ChangDropdowns(value){ if(value=="Other"){ document.getElementById('element').style.display=''; }else{ document.getElementById('element').style.display='none'; } } </script> </head> <body> <form> <select id="material" name="material" onchange="ChangeDropdowns(this.value);"> <option value="Yes">Yes</option> <option value="No">No</option> <option value="Other">Other</option> </select> <input type=text id="element" name="material"> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/148955-solved-show-hide-not-working/ Share on other sites More sharing options...
Darkness Soul Posted March 11, 2009 Share Posted March 11, 2009 I assuming you copy-paste your code to the forum, right? You misstyped the function name, take a look: onchange="ChangeDropdowns(this.value);" function ChangDropdowns(value){ Chang and Change, missing an "E". That's might solve your problem. Link to comment https://forums.phpfreaks.com/topic/148955-solved-show-hide-not-working/#findComment-782128 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.