Tuesday, December 23, 2008

How to hide control using javascript?

The answer written in the first response is not actually 100% accurate.

We can hide/display the controls using

1) document.getElementById("").style.display="none"/document.getElementById("").style.display="inline"

or

2)
document.getElementById("").style.visibility="visible";/document.getElementById("").style.visibility="hidden";

The difference between the two is using the 1st option, we can hide the control and the space occupied by the controls also gets
removed, i.e if the controls has a certain height and is contained in a table row, the row gets collapsed and when displayed, the control will again take it's place.and the row will again retain its height by displaying the control in it.

On the other hand if we use 2nd option, the control will get hide
but the space occupied by the control will remain as it is and the row will not collapse, i.e the row will still be displayed
as blank containing the control in hidden mode.

From http://www.dotnetspider.com/resources/6563-How-hide-control-using-javascript.aspx

1 comment:

mary Brown said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai