Sometimes, we want to fix document.getElementById("test").style.display="hidden"
not working with JavaScript.
In this article, we’ll look at how to fix document.getElementById("test").style.display="hidden"
not working with JavaScript.
How to fix document.getElementById(“test”).style.display=”hidden” not working with JavaScript?
To fix document.getElementById("test").style.display="hidden"
not working with JavaScript, we should set the display
property to 'none'
or the visibility
to 'hidden'
.
For instance, we write:
<div id='test'>
hello world
</div>
to add the div with ID test
.
Then we write:
document.getElementById("test").style.display = "none";
or
document.getElementById("test").style.visibility = "hidden";
to either set the display
property to 'none'
or the visibility
property to 'hidden'
to hide the div.
Conclusion
To fix document.getElementById("test").style.display="hidden"
not working with JavaScript, we should set the display
property to 'none'
or the visibility
to 'hidden'
.