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.
Feel free to contact me for any help related to jQuery, I will gladly help you.
Here is a piece of code that will load CSS using jQuery.
1 | $(document).ready(function(){ |
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 | }); |
9 | }); |
0 comments:
Post a Comment
Don't Forget to comment