Javascript onChange Script To Make Form Area Appear or Disappear

In a website I am working on, I want to display/hide an area of a form according to the value selected from a scroll-down by the user.
gianchi66Asked:
Who is Participating?
 
Michel PlungjanIT ExpertCommented:
0
 
Michel PlungjanIT ExpertCommented:
<select onChange="var val=this.options[this.selectedIndex].value;
document.getElementById('otherDiv').style.display=(val=='other')?'':'none'">
<option value="">Please select</option>
<option value="A">A</option>
<option value="other">Other</option>
</select>
<div id="other" style="display:none"><input type="text" name="otherValue" value=""></div>
0
 
gianchi66Author Commented:
I cracked up.

Isn't that beautiful? I even forgot I had asked that question already...

Do you have kids? That's how you loose your memory.
0
 
Michel PlungjanIT ExpertCommented:
Ohhh, I thought it was the pints...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.