Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript classlist add

// select element and append class
const div = document.querySelector('div');
div.classList.add('class-1', 'class-2', 'class-3', 'class-n');

// create element and append class
const div = document.createElement('div');
div.classList.add('class-1', 'class-2', 'class-3', 'class-n');
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #classlist #add
ADD COMMENT
Topic
Name
6+9 =