Click Action on multiple elements - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Click Action on multiple elements

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.8.3.js"></script> 
  <script type="text/javascript">
$(document).ready(function(){
      $("#button1").click(function(){
           $(this).hide();/*from  w  w  w  .ja  va  2  s. c om*/
      });
      $("p").click(function () {
        $(this).css('background-color', 'green');
     });
  });

      </script> 
 </head> 
 <body> 
  <button id="button1">Button1</button> 
  <p>This is a block element</p>  
 </body>
</html>

Related Tutorials