JSFiddle - React, Tailwind, and code Playground
by justinwyllie
HTML
<div id="div1">
Div 1
</div>
<div id="div2">
Div 2
</div>
JavaScript
const div1 = document.getElementById('div1');
div1.style.backgroundColor = 'red';
div1.innerHTML = 'Hello World';
//Ex 1 - make div2 green and say "I am a green div";
//Ex 2 - what does this do?
function makeBlue(el) {
el.style.backgroundColor = "blue";
}
const l = document.querySelectorAll("div");
i.forEach(el => makeBlue(el))