Javascript examples for CSS Style Property:visibility
The visibility property sets or gets whether an element should be visible.
Value | Description |
---|---|
visible | Visible. This is default |
hidden | Not visible, but occupy the space |
collapse | used on a table row or cell |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | visible? |
Return Value: | A String, representing whether the content of an element is displayed or not |
CSS Version | CSS2 |
Hide the content of a <p> element:
<!DOCTYPE html> <html> <body> <p id="myP" style="visibility:hidden;">This is a p element.</p> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w . j a v a2 s . com document.getElementById("myP").style.visibility = 'hidden'; } </script> </body> </html>