Tell us what’s happening:
Preview looks fine at first.
After I run the Tests, it does not pass the test 8 and the test 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>
<h1>Kitchen Utensils</h1>
<ul class="item-list">
<li class="item">
whisk
<button id="whk" class="favorite-icon">♡</button>
</li>
<li class="item">
mixing bowel
<button id="mxb" class="favorite-icon">♡</button>
</li>
<li class="item">
spoon
<button id="spn" class="favorite-icon">♡</button>
</li>
</ul>
</body>
<script src="script.js"></script>
</html>
/* file: styles.css */
.item {
display: flex;
align-items: center;
justify-content: space-between;
width: 150px;
}
.filled {
color: red;
}
/* file: script.js */
const whk = document.getElementById("whk");
const mxb = document.getElementById("mxb");
const spn = document.getElementById("spn");
let whkFilled = false;
let mxbFilled = false;
let spnFilled = false;
whk.addEventListener("click", () => {
if (whkFilled === false) {
whk.classList.add("filled");
whk.innerHTML = "❤";
} else {
whk.classList.remove("filled");
whk.innerHTML = "♡";
}
whkFilled = !whkFilled;
});
mxb.addEventListener("click", () => {
if (mxbFilled === false) {
mxb.classList.add("filled");
mxb.innerHTML = "❤";
} else {
mxb.classList.remove("filled");
mxb.innerHTML = "♡";
}
mxbFilled = !mxbFilled;
});
spn.addEventListener("click", () => {
if (spnFilled === false) {
spn.classList.add("filled");
spn.innerHTML = "❤";
} else {
spn.classList.remove("filled");
spn.innerHTML = "♡";
}
spnFilled = !spnFilled;
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0
Challenge Information:
Build a Favorite Icon Toggler - Build a Favorite Icon Toggler
https://www.freecodecamp.org/learn/full-stack-developer/lab-favorite-icon-toggler/build-a-favorite-icon-toggler