.classList
var myElement = document.getElementById("myElementID");
myElement.classList.add("style1 style2");
myElement.classList.remove("style1 style2");// .classList method returns an array of the classes attached to the element it is called with.
document.getElementById("myDIV").classList
// It returns
// [ 'className1', 'className2', ... ]
Also in JavaScript:
- how to set up a success message show up if form is submitted in react hooks
- how to get the height of window in javascript
- jquery watch checkbox change
- check if element is visible
- javascript online test
- unexpected token react native stack navigation
- how to find element in array angularjs
- chroma js contrast check
- JavaScript append HTML
- js data object length
- get year javascript copyright
- keyboard event height react native
- js test if array
- electron remove default menu
- react native modal
- jquery select a dynamic element
- how to write statefull class in react
- react search when stop typing
- shadow using react native
- javascript show 2 decimal places
- cypress memory leak
- allow cross origin node
- append new element for each value in array d3.js
- js ask before close chrome