Date: 2010jun30
Updated: 2011nov24
Language: javaScript
Platform: jQuery
Q. How do I disable/enable a button with jQuery?
A. Disable like this:
$('#mybutton').attr('disabled', true);
Enable like this:
$('#mybutton').attr('disabled', false); // or you can remove the
attribute
You could make a wrapper function as so:
function enableButton(query, is_enabled) {
$(query).attr('disabled', !is_enabled);
}
Example use:
enableButton('#mybutton', false); // disables it
enableButton('#mybutton', true); // enables it
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment