Answers for "javascript variable in html string"

1

javascript variable in html string

let div = document.createElement("div");
div.classList.add("yourClass");
div.setAttribute("onclick", "yourFunction()");
div.setAttribute("onmouseover", "hoverOn()")
div.style.background = "yourColor";
let divInDiv = document.createElement("div");
divInDiv.classList.add("yourClass");
div.appendChild(divInDiv);
Posted by: Guest on June-10-2021

Code answers related to "javascript variable in html string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language