The visibility property is used to hide or show the content of HTML elements. The visibility property specifies that the element is currently visible on the page. The ‘hidden’ value can be used to hide the element. This hides the element but does not remove the space taken by the element, unlike the display property.
element.style.visibility = 'hidden'; element.style.visibility = 'visible';
- Clicking the Hide button:
- Clicking the Show button:
Note: Here after clicking the hide button the element will become invisible and left the space blank.
- Hide or show elements in HTML using display property
- How to display icon next to show/hide text on button?
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- HTML | DOM Style visibility Property
- CSS | visibility Property
- CSS | backface-visibility Property
- Visibility of elements in bootstrap with Examples
- p5.js | show() Function
- AngularJS | ng-show Directive
- jQuery | Effect show() Method
- p5.js | hide() Function
- jQuery | hide() with Examples
- AngularJS | ng-hide Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.