Preston
Preston

Reputation: 2185

Jquery Check stylesheet and do action

me again! I'm learning a lot from this site!

Now.. i want to know how do i check with jQuery what stylesheet i'm using and perform an action. In the case, place a favicon..

i have this script for change stylesheet on my page:

$("#painel_faccao li a").click(function() { 
    $("link#faccao").attr("href",$(this).attr('rel'));      
    $.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
 return false;

});

and my favicon on page:

<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />

i know i must use this:

$("#favicon").attr("href","favicon2.png");

but i don't know how to make jquery check the stylesheet..

someone can help me?

Upvotes: 3

Views: 980

Answers (1)

Greg
Greg

Reputation: 21909

To check which stylesheet is used, you can check the link href just like you are on the favicon.

alert ("Your stylesheet is: " + $("link[rel='stylesheet']").attr("href"));

Upvotes: 3

Related Questions