Javascript Element How to - Hide / Unhide div








Question

We would like to know how to hide / Unhide div.

Answer


<!DOCTYPE html>
<html>
<body>
  <div id="hideme">Blah.</div>
  <script>
    setTimeout(function () {<!--from  w  w w.j ava2 s.c om-->
         document.querySelector('#hideme').style.display = 'none';
    }, 3000);
    </script>
</body>
</html>

The code above is rendered as follows: