Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add css class to html in js

document.getElementById("container").classList.add("main");
Comment

javascript add CSS class

const myElement = document.querySelector(".my-element");

myElement.classList.add("my-class");
Comment

PREVIOUS NEXT
Code Example
Javascript :: fill array with array javascript 
Javascript :: subarray javascript 
Javascript :: Remove uploaded file in jquery 
Javascript :: moment js remove seconds 
Javascript :: javascript json to excel 
Javascript :: custom hook react 
Javascript :: template literal 
Javascript :: usecontext multiple provider 
Javascript :: microbit hello world 
Javascript :: mdn objects javascript 
Javascript :: javascript if object element exists 
Javascript :: get cos in degree javascript 
Javascript :: JavaScript for loop Display Numbers from 1 to 5 
Javascript :: javascript Adding Element to the Inner Array 
Javascript :: javascript copy array using spread operator 
Javascript :: xhr.upload 
Javascript :: javaScript values() Method 
Javascript :: cntl intellisense tailwind 
Javascript :: how to divide a month into weeks in moment js 
Javascript :: nodejs: express, morgan, mongoose package 
Javascript :: change rotation phaser 
Javascript :: phaser set x y 
Javascript :: Counting Duplicates 
Javascript :: rotate matrix 90 degrees javascript 
Javascript :: React "Nothing was returned from render Error" Solution 
Javascript :: show fist 100 character use js 
Javascript :: expected a string (for built-in components) or a class/function (for composite components) but got: undefined 
Javascript :: js includes case insensitive 
Javascript :: regex and 
Javascript :: react simple typewriter 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =