Hide selected element or DIV when clicked - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Hide selected element or DIV when clicked

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*ww w .  j  a  va 2s  .c o  m*/
document.getElementById("hideme").onclick = function() {
        document.getElementById("hideme").style.display ="none";
    };
    }

      </script> 
   </head> 
   <body> 
      <div id="hideme">
         HIDE THIS DIV
      </div>  
   </body>
</html>

Related Tutorials