showing results for - "javascript variable in html string"
Christopher
22 Nov 2019
1let div = document.createElement("div");
2div.classList.add("yourClass");
3div.setAttribute("onclick", "yourFunction()");
4div.setAttribute("onmouseover", "hoverOn()")
5div.style.background = "yourColor";
6let divInDiv = document.createElement("div");
7divInDiv.classList.add("yourClass");
8div.appendChild(divInDiv);