Using Javascript
-
Disabling a html button
document.getElementById("Button").disabled = true;
-
Enabling a html button
document.getElementById("Button").disabled = false;
Using jQuery
All versions of jQuery prior to 1.6
-
Disabling a html button
$('#Button').attr('disabled','disabled');
-
Enabling a html button
$('#Button').removeAttr('disabled');
All versions of jQuery after 1.6
-
Disabling a html button
$('#Button').prop('disabled', true);
-
Enabling a html button
$('#Button').prop('disabled', false);
P.S. Updated the code based on jquery 1.6.1 changes. As a suggestion, always use the latest jquery files and the prop()
method.