Results 1 to 2 of 2
Jun 29, 2002, 19:46 #1
How can i hide a text box? When...
I have 2 radio buttons as fallow:
<input type="radio" name="test" value="Yes" checked>Yes
<input type="radio" name="test" value="No">No
And a text box:
<input type="text" name="cnl" size="30">
I want to hide the text box when the user choose "No" and show it when he choose "Yes".
How can i do that?
Thanks...Why It Doesn't Work?!
Jun 29, 2002, 20:08 #2
- Join Date
- Jun 2002
- 0 Post(s)
- 0 Thread(s)
I believe you could do something along the lines of:
document.formname.element.style.visibility = 'hidden';
However hiding the box does not conform with commonly accepted user interface standards, and as such may confuse some users... not to mention that it will most certainly not work the same on all browsers.
The preferred method would be to disable the text box, rather than hiding it. This is accomplished by setting the element's disabled property to true.
This will be far more cross-browser compatible, as well as being more congruent with the rest of the software/OS/web apps that your viewers use.