Archive for the ‘css’ Category
How to load css files with AJAX using jQuery
July 22, 2010This week I was building a music player widget with jQuery and decided to make multiple skins available for people to choose from.
I figured I needed to dynamically load the css files with AJAX when the widget is initialized.
This is what I came up with:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $.ajax({ url:"style.css", success:function(data){ $("<style></style>").appendTo("head").html(data); } }) }) </script>

