Link to home
Start Free TrialLog in
Avatar of tlp560
tlp560

asked on

hide/un-hide section (on check/un-check checkbox)

I have a list of checkboxes that asking users for input, the last one will be "Others" - when users selected this checkbox, it'll show another textarea so they can type in some text ... when they un-checked the box, the textarea should be disappear.

<form action = "test.asp" method="post">
   <input type="checkbox" name="name1" value="value1"> Value1
   <input type="checkbox" name="name2" value="value2"> Value2
   <input type="checkbox" name="name3" value="others"> Others
    below will be shown only when user selected "Others", disappear when uncheck.
    <textarea name="text2Enter" rows="3" cols="30"></textarea>

</form>

Please help :) thank you very much,
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wimthepimscake
wimthepimscake

or <input type="checkbox" name="name3" value="others" onclick="document.getElementById('text2Enter').style.display=(this.checked?'blocked':'none')">
you probably mean "block" and not "blocked"!?