javascript inject html 1

javascript inject html

var html = 'Play';
document.querySelector(".elmentToInjectIn").innerHTML = html;

Here is what the above code is Doing:
1. We’re creating a variable called html and assigning it a string of HTML.
2. We’re using the querySelector() method to select the element with the class of elementToInjectIn.
3. We’re using the innerHTML property to inject the HTML string into the element.

Similar Posts