View Full Version : How to make a textBox invisible using javascript

12-06-2006, 10:18 AM

i want to make my textbox invisible in certain cases, is it possible to do using javascript or by any other means


12-06-2006, 10:31 AM
yes it is.

you can change the style of the object like so:

<input type=text id=text1>
<input type=button value=hide onclick=hide()>
<input type=button value=show onclick=show()>
<script type=text/javascript>
function hide(){
function show(){

the above is not cross-browser friendly though, as different browsers require different values to be set to the visibility.

however comma though......

you can change the display of the object:
document.getElementById('text1').style.display="none"; //for hide
document.getElementById('text1').style.display="block"; //for show

there is a difference in the two ways. changing the objects visibility does just that, it still takes up the space it would if it were visible. where changing the display of an object hides it and all other objects around it fill in the space.

12-06-2006, 01:08 PM
thank you..brandon :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum