简体   繁体   中英

font-color of disabled input box in IE

如何设置已禁用的输入框的字体颜色(仅适用于IE)

IE uses system controls for form fields. You can't change them from the CSS. You would have to pack inputs in divs and make the inputs transparent. And don't use HTML disabled attribute then, but disable it with javascript.

For better results - find a jquery plugin for doing good looking inputs.

You can't do this with CSS, because older versions of IE don't have the necessary support.

Your best bet is to use a Javascript work-around. When the input box is disabled, run a script to change the class name, and style the text colour differently on that new class name. If the input box is re-enabled, use a similar script to change the class name back to what it was originally.

This is sort of discussed here: http://codingforums.com/showthread.php?t=147842

It depends of what you need but you may trick that using the readonly property on the input, making the background grey and the typo the way you want with CSS.

But, for example, if you use it in a form and PHP, with disable, the variable isn't sent, with readonly, it is... It might be a problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM