Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove all CSS Stylesheets from a page

Tags:

jquery

css

I want to show a page without any css applied. Is it somehow possible to add a jquery switch inside the page to disable all stylesheets?

Reason: I want to show a client the importance of Design by giving him the opportunity to disable the css styles of his site. It is way more convincing when he can trigger it on his own :)

like image 742
KSPR Avatar asked Dec 11 '22 18:12

KSPR


2 Answers

If you want it to fire after a click:

$(".element").click(function(){
    $("link[rel='stylesheet']").remove();
});

or at the beginning:

 $(document).ready(function(){
        $("link[rel='stylesheet']").remove();
 });
like image 129
Roman Holzner Avatar answered Dec 22 '22 01:12

Roman Holzner


Try this:

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

This will remove all stylesheets (all the styles applies due to those stylesheets) from the page.

like image 30
techfoobar Avatar answered Dec 22 '22 01:12

techfoobar