Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An implementation of $.getScript but for stylesheets. Call it $.getStylesheet
(function($) {
$.getStylesheet = function (href) {
var $d = $.Deferred();
var $link = $('<link/>', {
rel: 'stylesheet',
type: 'text/css',
href: href
}).appendTo('head');
$d.resolve($link);
return $d.promise();
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment