Apply jquery hover for multiple elements - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:live

Description

Apply jquery hover for 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.7.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*ww  w  . j  av a  2s.  com*/
$('div').live('click', function() {
    $(this).html('clicked');
});
$('div:first').add('div:last').click();
    });

      </script> 
 </head> 
 <body> 
  <div>
    test1 
  </div> 
  <div>
    test2 
  </div> 
  <div>
    test3 
  </div>  
 </body>
</html>

Related Tutorials