Skip to content

Instantly share code, notes, and snippets.

@cvd
Created February 24, 2014 16:29
Show Gist options
  • Save cvd/9191614 to your computer and use it in GitHub Desktop.
Save cvd/9191614 to your computer and use it in GitHub Desktop.
Inject css
$('head #missionStyles').remove();
var css_href = "some/path/to.css";
if (document.createStyleSheet) {
var $link = $("<link>");
$link.appendTo($('head'))
.attr('id', 'missionStyles')
.attr({type : 'text/css', rel : 'stylesheet'})
.attr('href', css_href);
} else {
$('head').append("<link id='missionStyles' rel='stylesheet' href='"+css_href+"' >");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment