Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js classlist

// querySelector() - you can use element name / #id / .class
const varName = document.querySelector('div #idName .className');
// add class - classList.add()
varName.classList.add('someClassName'); // class name without the dot 
// remove class - classList.remove()
varName.classList.remove('someClassName');
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #classlist
ADD COMMENT
Topic
Name
8+3 =