Beginner
A like button
Build a button with id="like". It starts with the text Like. Clicking it switches it to Liked and gives it the class liked. Clicking again switches back to Like with no liked class.
Keep one piece of state (true or false) and work out both the text and the class from it.
What Check tests
- It starts as
Likewithout thelikedclass - One click shows
Likedwith thelikedclass - A second click goes back to
Likewithout the class
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.