javascript - How to dynamically remove a stylesheet from the current page -


is there way dynamically remove current stylesheet page?

for example, if page contains:

<link rel="stylesheet" type="text/css" href="http://..." /> 

...is there way later disable javascript? points using jquery.

well, assuming can target jquery should simple calling remove() on element:

$('link[rel=stylesheet]').remove(); 

that remove all external stylesheets on page. if know part of url can remove 1 you're looking for:

$('link[rel=stylesheet][href~="foo.com"]').remove(); 

and in javascript

this example of remove query selector , foreach array

array.prototype.foreach.call(document.queryselectorall('link[rel=stylesheet]'), function(element){       try{         element.parentnode.removechild(element);       }catch(err){}     });  //or similar var elements = document.queryselectorall('link[rel=stylesheet]'); for(var i=0;i<elements.length;i++){     elements[i].parentnode.removechild(elements[i]); } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -