Jump to content

Enable Disabled Input?


Twango
 Share

Recommended Posts

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...