How do you re-enable an element after disabling it开发者_如何学运维 this way?
$("#foo").attr("disabled", "disabled");
Assuming you're using a recent version of jQuery (1.6+), a more appropriate way of toggling the disabled
attribute is using .prop()
:
$("#foo").prop("disabled", true);
$("#foo").prop("disabled", false);
See jQuery API documentation for .prop() for an explanation.
This should do it:
$('#foo').removeAttr('disabled');
and this as well:
$('#foo').attr('disabled', '');
$('#foo').removeAttr('disabled');
OR you can set attr to ""
$('#foo').attr('disabled', '');
精彩评论