get clicked button itself in a function and disable it - Javascript jQuery

Javascript examples for jQuery:Form Button

Description

get clicked button itself in a function and disable it

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> 
  <script type="text/javascript">
    window.onload=function(){// w w  w . j  a  v a2  s.co  m
$("input:button").click(function()
{
    $(this).prop("disabled",true);
});
    }

      </script> 
 </head> 
 <body> 
  <input type="button" value="Disable me"> 
  <input type="button" value="Disable me">  
 </body>
</html>

Related Tutorials