JS body class

javascript

Best

window.document.documentElement.className =
window.document.documentElement.className.replace(/\bno-js\b/g, '') + ' js '
;(function(H) {
H.className = H.className.replace(/\bno-js\b/, 'js')
})(document.documentElement)

Add to <html>

<script>
document.body.parentElement.className = document.body.parentElement.className.replace(
'no-js',
'js'
)
</script>

Add to <body>

<script type="text/javascript">
document.body.className = document.body.className
? document.body.className + ' js'
: 'no-js'
</script>
Edit this page
Want to make your own site like this? Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My memory bank.