enabling a disabled button
This question already has an answer here:
The disabled attribute's value doesn't matter, it just needs to be set to work.
Try removing the attribute entirely like this:
$("#myButton").removeAttr("disabled");
I always use this, which worked for me:
$("#myButton").prop('disabled', false);
Also see this: Disable/enable an input with jQuery?
Because the disabled
attribute is a boolean attribute. It works by its mere presence, regardless of its value. I could write disabled="I'm a broken paperclip"
and it would still work.
Try:
document.getElementById('myButton').disabled = true; // disable
document.getElementById('myButton').disabled = false; // re-enable
Vanilla JS is so much simpler...
链接地址: http://www.djcxy.com/p/23004.html上一篇: 如何用jQuery或Javascript禁用页面上的元素
下一篇: 启用禁用的按钮