Dynamically Applying Inline or External CSS with jQuery
When loading HTML content via AJAX using jQuery, you may encounter issues with applying CSS to the loaded content. This is because dynamically added CSS is not automatically evaluated by the browser.
Options for Evaluation:
To resolve this issue, you can use several methods to evaluate CSS dynamically:
1. Using AJAX to Load CSS:
$.get(myStylesLocation, function(css) { $('<style type="text/css"></style>').html(css).appendTo("head"); });
2. Using Dynamically-Created :
$('<link rel="stylesheet" type="text/css" href="'+myStylesLocation+'" >').appendTo("head");
3. Using Dynamically-Created