Answers for "how to create a dom class js"

10

Javascript change element class

document.getElementById("myElementID").classList.add('myClassName');
document.getElementById("myElementID").classList.remove('myClassName');
Posted by: Guest on July-22-2019
6

create element javascript with class

// create div element by javascript with class

var div = document.createElement('div');
div.className = "div1";
Posted by: Guest on June-15-2020
0

js create element with class

var element =document.createElement("span");
        element.className = "aClassName";
Posted by: Guest on December-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language