How to show/hide HTML input fields when checkbox is checked?

  • Thread starter Thread starter crazymao
  • Start date Start date
C

crazymao

Guest
Ok so here is my code:
<input type='checkbox' name='yn'>

Now what I want is for a input field to appear exactly when the checkbox is checked and to "hide" exactly when the checkbox becomes unchecked. Lets say I want this to appear:
<input type='text' name='field2'>

I want to do this with a nice, short, clean piece of code. Any help will be greatly appreciated.
 
Back
Top