Tell us what’s happening:
I don’t understand why I cannot pass step 6, 8, or 9.
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Favorite Icon Toggler</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<ul class = "item-list">
<li>why are you so sad for a girl so in love
<button class = "favorite-icon" >♡</button>
</li>
<li> Do That Again
<button class = "favorite-icon"> ♡</button>
</li>
<li> My Reckless Abondon
<button class = "favorite-icon" > ♡</button>
</li>
</ul>
</body>
</html>
/* file: styles.css */
.filled {
background-color: red;
}
/* file: script.js */
const btns = document.querySelectorAll("favorite-icon");
const updateButton = (btn) => {
if (btn.classList.contains("filled")) {
btn.classList.remove("filled")
btn.textContent = "♡"
} else if (!btn.classList.contains("filled")) {
btn.classList.add("filled")
btn.textContent = "❤"
}
}
btns.forEach(btn => {
btn.addEventListener("click", () => {
updateButton(btn);
})
})
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
Challenge Information:
Build a Favorite Icon Toggler - Build a Favorite Icon Toggler