Javascript examples for jQuery:Mouse Event
Get the id of a the item that is clicked
<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(){/*from w w w. j av a2 s . c o m*/ $('b.edit').click(function(){ console.log($(this).attr('id')); }); }); </script> </head> <body> <b class="edit" id="foo1">FOO</b> <b class="edit" id="foo2">FOO2</b> <b class="edit" id="foo3">FOO3</b> </body> </html>