Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

add multiple class using javascript code example

Example 1: add multiple class list at once in js

elem.classList.add("first");
elem.classList.add("second");
elem.classList.add("third");

is equal to :

elem.classList.add("first","second","third");

Example 2: add multiple class from array javascript

const classArray = ["cl1", "cl2", "cl3"];
div.classList.add(...classArray);

Tags:

Javascript Example

Related

docker save image from running container code example laravel eloquent delete all code example check for updates in git bash code example chromium python webdriver ubutnu code example handling select in selenium code example mui button with text and icon code example find js regex code example FasterXML jackson json java code example upload is C:\fakepath\ code example add git repo to package json code example python integer divide code example tint images css code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy