This is one of the simplest solutions to a "hard-coded" aspect of Internet Explorer, which is that you can't adjust the font color of disabled form elements.

<input type="text" name="mytext" readonly="true" />

By using the readonly attribute, instead of the disabled attribute, you are able to style the font color while still preventing the user from modifying the value in the element.

Note that the readonly attribute carries a few differences than disabled. Read-only form elements will be passed to the form processing script. They will also be in the tab order and display a caret cursor on hover.

Leave a Reply

Your email address will not be published. Required fields are marked *