Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
 
PREVIOUS NEXT
Tagged: #javascript #variable #html #string
ADD COMMENT
Topic
Name
4+7 =