Jump to content

[SOLVED] Show Hide not working


kyleldi

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.