April 14, 2012
How can I "remove" the disabled attribute on click?
Question by Strawberry
I couldn’t quite get it to work properly. I’m trying to remove the disabled attribute on click so that I can edit it.
My jQuery:
$('#edit-credentials').click(function() {
$('#credentials :input').prop("disabled", !$('#credentials:input').prop("disabled"))
});
HTML:
<a id="edit-credentials" onclick="return false;" href="#">edit</a>
<div id="credentials">
<input disabled="disabled">
<input disabled="disabled">
</div>