Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlexander Stanuga
11,999 Pointskeeps telling me "You didn't pass the toggle() method"
I'm pretty sure I have the code right for Task 2, but I keep getting told I'm not passing the toggle() method, which is strange. The code I've got is below:
var anchor = document.querySelector("a");
//Add the class to the classList "selected"
anchor.classList.add("selected");
//Toggle the class "live"
anchor.classList.toggle("Live");
<!DOCTYPE html>
<html>
<body>
<a href="#">Home</a>
<script src="app.js"></script>
</body>
</html>
2 Answers
Alexander Stanuga
11,999 PointsNever mind, I figured it out, I was meant to use lowercase 'l' for 'live'
Alex Heil
53,547 Pointshey Alexander Stanuga , you're pretty close ;) just check the toggle-line again and look closer at the argument. you passed in Live (with a capital L), while the task wants you to call live, all lowercase.
if you change that the code will past just fine. hope that helps and have a nice day ;)
Alexander Stanuga
11,999 PointsThanks Alex, I just realised after trying all over again.