Show javascript alert and do other actions for div element - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:click

Description

Show javascript alert and do other actions for div element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> 
      <script type="text/javascript">
$(function() {/*  ww w  .  j  a v  a2s .  c om*/
    $(".clickMe").click(function() {
       console.log('hi!');
       
    });
});

      </script> 
   </head> 
   <body> 
      <div class="clickMe">
         Click Me!
      </div>  
   </body>
</html>

Related Tutorials