How to Disable image button
I have an button whose type is image i want to disable button till some action following is the html tag
How to 开发者_如何学JAVAdisable this button?
You can add a click that returns false:
$('#myButton').click(function() { return false; });
You might want to add a message that explains why it's disabled, and possibly some CSS to make it look disabled as well.
This is the code I use to disable or re-enable a control:
function handleControlDisplay(className, foundCount, checked) {
var button = jQuery(className);
if (foundCount > 0 && foundCount == checked) {
// enable
button.removeAttr("disabled");
}
else {
// set the disabled attribute
button.attr("disabled", "true");
};
}
精彩评论