Javascript examples for jQuery:Mouse Event
Get index of clicked element in collection with jQuery
<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"> $(window).load(function(){/*w w w . ja v a2s . c o m*/ $('li').click(function (event) { console.log($(this).index()); }); }); </script> </head> <body> <li>Test</li> <li>Test</li> <li>Test</li> <li>Test</li> <li>Test</li> </body> </html>