I'm loading a CSS file dynamically after the document.ready function fired. This is what I have:
$.get(TheCSSTag.href, function () {
alert('loaded');
DoSomething();
}, "text/css");
The problem is that the alert triggers fine (which I assume means the CSS loaded) but the styles aren't applied to the HTML elements.
Note: other solutions that involve creating a CSS tag and appending to the DOM like this document.getElementsByTagName('head')[0].appendChild(TheCSSTag); don't work for me because I need a callback function to execute when the CSS file loaded.
$.get()do that if you add"text/css"there?