Javascript examples for jQuery Method and Property:click
Set event function trigger in looping 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.9.1.js"></script> </head> //from w ww .j a va2 s . c om <body> <button class="someclass" data-value="1">click 1</button> <button class="someclass" data-value="2">click 2</button> <script type="text/javascript"> $('.someclass').click(function(){ console.log($(this).attr('data-value')); }); </script> </body> </html>