Wednesday, 6 August 2014

How To Disable Submit Button After Clicked With JQuery


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://code.jquery.com/jquery.js" type="text/javascript"></script>
<script>
$(function () {
$("#btnDisable").click(function () {
$('#btnSubmit').attr('disabled', 'disabled');
});
$("#btnEnable").click(function () {
$('#btnSubmit').removeAttr('disabled');
});
$("#btnSubmit").click(function () {
alert('I have enabled');
});
});
</script>
</head>
<body>
<button id="btnSubmit">Submit</button>
<button id="btnDisable">Disable</button>
<button id="btnEnable">Enable</button>
</body>
</html>
view raw gistfile1.html hosted with ❤ by GitHub