Twango Posted January 24, 2010 Share Posted January 24, 2010 how do i enable a text-input that has been disabled? Link to comment Share on other sites More sharing options...
boen_robot Posted January 24, 2010 Share Posted January 24, 2010 Get the disabled element somehow (e.g. getElementById(), querySelectorAll(), etc.), and set its disabled property to false.Being any more explicit will require some links or code on your part. Link to comment Share on other sites More sharing options...
Synook Posted January 24, 2010 Share Posted January 24, 2010 Just removeAttribute() its disabled attribute. Link to comment Share on other sites More sharing options...
Twango Posted January 24, 2010 Author Share Posted January 24, 2010 hmm, this isnt working. why? <html><body><script type="text/javascript">document.getElementById('a').disabled="false";</script></body></html><input type="checkbox" id="a" disabled="disabled"/> Link to comment Share on other sites More sharing options...
boen_robot Posted January 24, 2010 Share Posted January 24, 2010 hmm, this isnt working. why?<html><body><script type="text/javascript">document.getElementById('a').disabled="false";</script></body></html><input type="checkbox" id="a" disabled="disabled"/> disabled is boolean, not a string property. And the string "false" evaluates to a boolean true.BTW, your input is out of your <html/> element, and only appears after your script, so those things may be a problem too.So, a working (though still invalid) code is:<html><body><input type="checkbox" id="a" disabled="disabled"/><script type="text/javascript">document.getElementById('a').disabled=false;</script></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.