tags:

views:

44

answers:

1

Hi,

i want to check the style Tag if a classname exist or not.

if ($("head > style:eq(2)").hasClass('className')) 
{
  alert('yes');
}

Thanks in advance Peter

+2  A: 

You could access the document.styleSheets object:

see the all way in this answer

http://stackoverflow.com/questions/744319/get-css-rules-percentage-value-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>
Haim Evgi