IE 7 applies its own font color to disabled inputs. How can I override this and set my own font color?
相关问题
- Views base64 encoded blob in HTML with PHP
- How to fix IE ClearType + jQuery opacity problem i
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
There is no style for
disabled
. CSS3 supports:disabled
, but IE7 doesn't.kmb385's suggestion is probably the best you can do.
IE7 supports the
[attr]
selector, so you can simply use:This may cause issues with DHTML (you'll have to try it), in which case you may want to additionally set a class when working on dynamic elements:
Note that
[attr]
is the "has attribute" selector, there are a bunch of other selectors in the CSS spec. Becausedisabled
is a boolean attribute, you only have to check for its existence rather than any particular value.Give your input a class and add the styling via css.
Html:
CSS
Working Example: http://jsfiddle.net/TQUhD/1
As Diodeus comments :disabled is not supported in IE: http://reference.sitepoint.com/css/pseudoclass-disabled
No need to overrride CSS use class based approach and play with events works perfectly
You can do one thing: <button class="disabled" onmousedown="return checkDisable();" >
function checkDisable() {
}