You can show or hide the div element dynamically using Javascript DOM getElementById method. visibility property of style object can be accessed using getElementById method of document object. visibility property can get or set the value that provides the functionality to toggle the show hide state of HTML <div> tag dynamically. When you use visibility property to hide the div element, it just hides the div layer along with its child HTML elements and inner text but it does not release the space block captured by it on the HTML document.
Basically visibility property belongs to the CSS styles that help to hide or show the HTML elements. Javascript DOM style object can access this CSS property that can modify its value dynamically.
visibility: visibility property accepts two types of values hidden or visible. hidden value for visibility property hides the target HTML element where as visible value for the property shows the target HTML element.
You can set the hidden or visible value dynamically using Javascript to show or hide the div element’s visibility.
document. ElementById("id"). style.visibility = "visible";
document. ElementById("id"). style.visibility = "hidden";
Currently rated 3.5 by 2 people
Tags: javascript, html, dom, show hide div, html div tag, css visibility property, javascript getelementbyid, document object modeling, javascript div visibile, dhtml dynamic html, javascript style object
8/23/2008 8:55:00 PM