Jquery clone event handling - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:index

Description

Jquery clone event handling

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>

table tbody tr {
   background-color: LightGrey;
}
p.hi {//from  ww  w .  ja v  a2 s . c o  m
   color: lightgrey !important;
}
p {
   color: red;
}
      </style> 
 </head> 
 <body translate="no"> 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
  <script>
$( "table#hi tbody tr" ).click(function() {
var index = $( "table#hi tbody tr" ).index( this );
console.log(index);
});

    
      </script>  
 </body>
</html>

Related Tutorials