Your goal is to make the song picker fully work. When the title of a song is clicked:
- That song’s album art should appear
- The song’s title should be bold
You can check out a fully working demo.
- At the very top of the JavaScript code, write a new function called
switchSong. Your function should take one parameter, calledartSelector. - Your
switchSongfunction should first hide all of the covers on the page, and then show the element whose selector is given withartSelector. - Add a body to the three click handler we provided for you. The click handler should call
switchSongwith the appropriate selector argument. - Now write click handlers for the other two songs. Each click handler should contain a call to
switchSong.
Try it out! If you click a song title, you should see the art change to match the song you clicked.
- Add a second parameter to your
switchSongfunction, calledbuttonSelector. - In the body of
switchSong, add new instructions to make all of the buttons non-bold, and then make the element given bybuttonSelectorbold. - In your click handlers, pass a second argument to each call to
switchSongwith the appropriate button selector.
Try it out again! Now when you click a song title, not only will that song art appear, but the title will become bold.