Skip to content

Instantly share code, notes, and snippets.

@devi
Created February 13, 2011 15:02
Show Gist options
  • Save devi/824742 to your computer and use it in GitHub Desktop.
Save devi/824742 to your computer and use it in GitHub Desktop.
addCss, addJs
$.fn.addCss = function(css){
var style = document.createElement('link');
style.rel = 'stylesheet';
style.type = "text/css";
style.href = css;
document.getElementById($(this).attr('id')).appendChild(style);
};
$.fn.addJs = function(js){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = js;
document.getElementById($(this).attr('id')).appendChild(script);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment