solarisuser Posted July 16, 2007 Share Posted July 16, 2007 Hi All, Is it possible to use innerHTML to grey out (disable) a <input type=text> field when a particular checkbox (lets say, id=check123) has been clicked? Thanks... Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 16, 2007 Share Posted July 16, 2007 i don't know about using innerHTML, but why not simply change the disabled attribute of the input? all you'd have to do is set it to true and it would grey out the box and make it unchangeable. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 16, 2007 Share Posted July 16, 2007 akitchin is correct, I just wanted to add that you should avoid using innerHTML as much as possible. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted July 21, 2007 Share Posted July 21, 2007 the problem with setting disabled is that the form field value will not transmitted on submit. with a text field you can set readOnly instead: document.getElementById('textfieldID').readOnly = true; http://www.w3schools.com/htmldom/dom_obj_text.asp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.