Jquery check stylesheet and do action

me again! I learn a lot from this site!

Now .. I want to know how I can check with jQuery which stylesheet I use and execute. In this case, place the icon.

I have this script for the 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 page icon:

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

I know I have to use this:

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

but I don’t know how to make jquery style sheet validation.

can someone help me?

+3
source share
1 answer

To check which style sheet is used, you can check link hrefin the same way as on the icon.

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

Source: https://habr.com/ru/post/1789736/


All Articles