Set the element disabled property to false:
document.getElementById('my-input-id').disabled = false;
If you use jQuery, the equivalent will look like this:
$('#my-input-id').prop('disabled', false);
For several input fields, you can access them by class:
var inputs = document.getElementsByClassName('my-input-class'); for(var i = 0; i < inputs.length; i++) { inputs[i].disabled = false; }
Where document can be replaced with a form, for example, to find only elements inside this form. You can also use getElementsByTagName('input') to get all input elements. In your for iteration, you will need to check that inputs[i].type == 'text' .
David Hedlund Jul 30 '12 at 10:50 2012-07-30 10:50
source share