Load CSS files using jQuery

Today I got into a situation where I need to load CSS file dynamically using jQuery. My code was working in all the browsers except IE. But after spending couple of minute I was able to make proper cross browser solution. 

Here is a piece of code that will load CSS using jQuery.
2   $("head").append("<link>");
3   var css = $("head").children(":last");
4   css.attr({
5     rel:  "stylesheet",
6     type: "text/css",
7     href: "CSS/Demo.css"
8  });
Feel free to contact me for any help related to jQuery, I will gladly help you.


Post a Comment

Don't Forget to comment

About Me

My photo

HI i am mohammed  a Embedded Software Developer ,SEO specialist,Electronic engineer   Read more