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 Show and Hide div elements using Checkboxes ?
- How to Show and Hide div elements using radio buttons?
- How to display icon next to show/hide text on button?
- How to hide or show one record from an ng-repeat within a table based on ng-click?
- 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
- How to hide elements in responsive layout using CSS ?
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.