Jquery - How to check if class name exists
You can access the object document.styleSheets:
see all the way in this answer
get percentage value of CSS rule in jQuery
<script>
var rules = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
for (var i=0; rules.length; i++) {
var rule = rules[i];
if (rule.selectorText.toLowerCase() == ".classname") {
alert('found!!');
}
}
</script>
Another version, the same, only the difference is that sometimes for me selectorText is not defined
var rules = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
for (var i in rules)
{
if (typeof rules[i]['selectorText'] != 'undefined' && rules[i]['selectorText'].indexOf("fbconnect_button") >= 0)
{
alert('found!!');
}
}