In my CSS I have a rule that must be applied to all text fields (using the CSS3 selector input[type=text]
.
I also use jQuery. Some browsers like Internet Explorer 6 does not support that form for CSS selector. So my workaround is to add an extra classname in CSS:
input[type=text], .workaround_classname{
/* css styling goes here */
}
And via jQuery then add the CSS class:
$('input[type=text]').addClass('workaround_classname');
The Question is: How do I make sure this rule only is invoked when CSS3 selectors are not natively supported?
Why not set some useless css style and check if the style was applied. Only add the workaround class to the elements that don't have this style applied.
Only problem is I can't come up with a "useless" style you can use :-)
This seems to incorporate something like you speak of:
http://www.w3avenue.com/2009/07/02/detect-support-for-css3-html5-with-modernizr/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With