I’m currently working on the exercise in the DOM manipulation section. Here’s my code for the first two tasks:
a p with red text that says “Hey I’m red!”
an h3 with blue text that says “I’m a blue h3!”
const cont = document.querySelector('#container'); let redContent = document.createElement('p'); redContent.textContent = "Hey, I'm red!" ; redContent.style.color = 'red'; cont.appendChild(redContent); let blueContent = document.createElement('h1'); blueContent.textContent = "Hey I'm blue!"; blueContent.style.color = 'blue'; cont.appendChild(blueContent);
Although the HTML itself works, none of the changes I made in the JS are visible. I’ve tried to reposition the code but it didn’t do much difference. Is there something I’m overlooking?