How to hide a div in JavaScript?

To hide a div in JavaScript, do this: div.style.display = 'none'.

For example, if this is your div:

<div id="my-div"></div>

Then you can hide it with this JavaScript:

document.getElementById('my-div').style.display = 'none'