Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript stylesheet change if javascript is enabled Re: stylesheet change if javascript is enabled

#95601
jamygolden
Member

Check out Modernizr.
A class of ‘no-js’ must be given to the <html> element for the plugin to take effect. If it loads and fires correctly (javascript enabled) that class is removed and other classes are added to the html element (read about modernizr to find out more about that). Very basically though, you can use .no-js to style your web-page for people who don’t have it enabled.

.no-js #main-content { display: none; }
.no-js #js-disabled { display: block; }

those are just two small examples, but you get the idea.