Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove a list of classes from an element using js

To remove only a class,
const div =  document.querySelector('div');
div.classList.remove('info');

The remove() method also allows you to remove multiple classes at once,
like this:

const div = document.querySelector('div');
div.classList.remove('info','primary');
 
PREVIOUS NEXT
Tagged: #remove #list #classes #element #js
ADD COMMENT
Topic
Name
5+6 =