Search
 
SCRIPT & CODE EXAMPLE
 

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');
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if variable is jquery object 
Javascript :: toggle hook react 
Javascript :: how to generate random id in javascript 
Javascript :: javascript array add 
Javascript :: simple javascript code 
Javascript :: ngswitchcase in angular 8 
Javascript :: remove duplicates objects from array javascript 
Javascript :: jquery in array 
Javascript :: add onclick event jquery button 
Javascript :: js change value of every value in an object 
Javascript :: how to know if a number has a decimal number js 
Javascript :: strapi change user password 
Javascript :: ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @agm/core@1.1.0 npm ERR! Found: @angular/common@10.0.14 
Javascript :: nodejs request 
Javascript :: npm react dom routing 
Javascript :: add a Google Font to a VueJS 
Javascript :: chalk nodeks 
Javascript :: input clear 
Javascript :: if else alert js 
Javascript :: correct json type 
Javascript :: javascript localstorage 
Javascript :: javascript loop and array 
Javascript :: send a message using discord.js 
Javascript :: how to cache data in javascript 
Javascript :: json array 
Javascript :: for object 
Javascript :: factorial javascript function 
Javascript :: npm react pagination 
Javascript :: onclick function jquery 
Javascript :: loop elements in javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =