TILs, snippets—my digital code garden 🌱. By Zander Martineau
All tags All notes javascript (47) css (33) react (32) html (13) typescript (9) testing (8) node (4) cli (4) graphql (4) devops (4) git (4) cheatsheet (4) storybook (2) typography (2) networking (1) animation (1) services (1) api (1) a11y (1) deno (1) cypress (1) vscode (1) 11ty (1) untagged (15)
© 2023 • Made by Zander • Colophon • RSS

🤷‍♂️ JS body class

Note date 21 Jan, 2023
Tags javascript
On this page
  1. Add to
  2. Add to

Add to <body> Jump to heading

window.document.body.classList.add('some-class')
window.document.body.classList.replace('no-js', 'js')

Add to <html> Jump to heading

window.document.documentElement.classList.replace('no-js', 'js')

← Back home