To show or hide ‘div’ using JavaScript, we set the div’s style.display
property.
For instance, we write
element.style.display = "none";
to hide the element
by setting element.style.display
to 'none'
.
We write
element.style.display = "block";
To show the element
as a block element by setting element.style.display
to 'block'
.
Or we write
element.style.display = "inline";
To show the element
as an inline element by setting element.style.display
to 'inline'
.
Or we write
element.style.display = "inline-block";
To show the element
as an inline block element by setting element.style.display
to 'inline-block'
.