0
Good morning gentlemen and ladies,I’m making a comparison to change the color of a div if she has a background Yellow for green but I don’t understand why it’s not working
function exerciseTwo() {
let tagDiv = document.getElementsByTagName('div');
for(let i = 0; i < tagDiv.length; i += 1) {
if(tagDiv[i].style.backgroundColor == 'yellow') {
tagDiv[i].style.backgroundColor = 'green';
}
}
}
exerciseTwo();
Gabriel add tbm html to the question
– Ricardo Pontual