JavaScript – Hide HTML Element

To hide a HTML Element using JavaScript, get reference to this HTML Element, and assign value of "none" to the element.style.display property.

In the following example, we will hide the HTML Element with id "myElement" in JavaScript, using element.style.display property.

example.html

ADVERTISEMENT

Conclusion

In this JavaScript Tutorial, we learned how to hide a HTML Element using JavaScript.