hide textfields instantly when check a radio button
What I want is when the user chooses the first option the textfield will disappear and when the users chooses the second the textfield will appear again instantly. Here's some code:
<input type="radio" name="RadioGroup0" value="1" id="student" />
<input type="radio" name="RadioGroup0" value="0" id="not 开发者_开发百科student" />
and want to hide/show this:
<label for="department">department:</label>
<input name="department" type="text" class="label" value="" />
I have tried anything so I'll appreciate any answer
On the click, keyup, and change events, show or hide the appropriate elements (jQuery makes this easier). The reason for handling all the events is that the value change may only be triggered after the element loses focus.
Happy coding.
精彩评论