Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add class to new element javascript

    const exampleElement = document.createElement('div');

    exampleElement.classList.add("exampleClass");

	const container = document.getElementById('container1');
    container.appendChild(exampleElement);
Source by animate.style #
 
PREVIOUS NEXT
Tagged: #add #class #element #javascript
ADD COMMENT
Topic
Name
3+8 =