Javascript examples for jQuery:Form Button
Check what button was clicked
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function(){ $(".p").click(function(e){ console.log($(e.currentTarget).attr("value"));//button text on which you clicked });/* w ww . j ava 2 s .co m*/ }); </script> </head> <body> <input type="button" class="p" value="test"> </body> </html>