To remove all classes from an element, set the element's className property to an empty string, e.g. box. className = '' . Setting the element's className property to an empty string empties the element's class list.
Use the classList. remove() method to remove a class from a div element, e.g. box. classList. remove('my-class') .
I have a body element on which I add a few classes. And I want to remove the no-javascript
class from it, after it's being read by the browser.
<body class="foo boo no-javascript bla"> <script type="javascript"> // remove no-javascript class here </script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With