hi, no help button on this step. and totally blind. using jaws for windows 2025 with windows 11 pro. google chrome latest version. now encountering an issue where i then have to then use the function highlightCurrentSong and the chanining of the function to then play the current song. and it is not passing, have reset the lesson, done hard refresh, and also wrote the function hand code in the editor. so, is it my code? or is it a bug with the fcc? and totally frustrated. tried the latst 24 hours to try to get this to work, facing accessibility challenges. so, using a screen reader. can anyone help me to get this to pass. frustrated. pasting the errors, my html and javascript below.
thank you.
marvin.
ps: pasting below.
html:
const playButton = document.getElementById(“play”);
const allSongs = [
{ id: 0, title: “Song 0”, src: “song0.mp3” },
{ id: 1, title: “Song 1”, src: “song1.mp3” }
];
const audio = new Audio();
const userData = {
songs: allSongs,
currentSong: null
};
// — Step 37 function —
function highlightCurrentSong() {
const previous = document.querySelector(‘.playlist-song[aria-current=“true”]’);
const songToHighlight = document.getElementById(song-${userData.currentSong?.id});
if (previous) previous.removeAttribute(“aria-current”);
if (songToHighlight) songToHighlight.setAttribute(“aria-current”, “true”);
}
// Play song
function playSong(id) {
const song = userData.songs.find(s => s.id === id);
userData.currentSong = song;
audio.src = song.src;
audio.play();
highlightCurrentSong();
}
// Button to play first song
playButton.addEventListener(“click”, () => playSong(0));
// Playlist buttons
document.querySelectorAll(“.playlist-song”).forEach(songDiv => {
const id = Number(songDiv.id.split(“-”)[1]);
songDiv.querySelector(“button”).addEventListener(“click”, () => playSong(id));
});
errors:
You should use document.getElementById() and pass in `song-${userData.currentSong?.id}`.
2. You should use document.getElementById() and pass in `song-${userData.currentSong?.id}`.
3. You should assign your getElementById() to a songToHighlight variable.
link to the step:
https://www.freecodecamp.org/learn/full-stack-developer/workshop-music-player/step-37