Tell us what’s happening:
I thought by using the classList.toggle method i would pass the test.
Any assistance will be appreciated.
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><button class="favorite-icon">♡</button>
<li><button class="favorite-icon">♡</button>
<li><button class="favorite-icon">♡</button>
</ul>
<script src ="script.js"></script>
</body>
</html>
/* file: script.js */
const favoriteIcon = document.getElementById("favorite-icon");
//favoriteIcon.classList.toggle(".filled")
itemList.addEventListener("click",()=> {
favoriteIcon.classList.toggle("filled")
})
/* file: styles.css */
.filled{
background-color: lightgrey;
border: dotted 2px #000;
color:red;
}
.favorite-icon{
width: 100px;
height: 30px;
color: #fff;
background-color: #000;
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15
Challenge Information:
Build a Favorite Icon Toggler - Build a Favorite Icon Toggler