to start with I have this:
<body class="nojs">
I’m trying to remove the “nojs” class and replace with “js”, so I can set CSS fallbacks properly. This is the code I’m using:
<script>$("body").removeClass("nojs").addClass("js");</script>
I’m connected to jQuery as other plugins are working fine, however this just won’t work. Irrespective of whether I put it in the head or body tag.
Does anyone know what’s wrong? Still does not work when in a (document).ready function.
Works fine for me:
As suggested above. If you don’t use onReady then the DOM might not be ready in time for you to carry out your change.