Online Snippets Library

Disable Submit Button After click in jQuery

We need to add a "disabled" attribute to the submit button.

Example

HTML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<title>Disable Submit Button After click in jQuery</title>
</head>
<body>
<form action="#">
<p>
Disable Submit Button After click in jQuery.
</p>
<input type="submit" value="Submit"></input>
</form>
</body>
</html>
Javascript
$(document).ready(function(){
$('input:submit').click(function(){
$('p').text("Form has been submitted");
$('input:submit').attr("disabled", true); 
});
});