htmlcssjavascript28
Silver Coder
I am needing help figuring out how to fix 6 jlsint warnings in the code.
Code: Edit fiddle - JSFiddle - Code Playground
Full js part:
The 6 Warnings:
Code: Edit fiddle - JSFiddle - Code Playground
JavaScript:
const button = document.createElement("button");
button.className = station.buttonClass;
button.textContent = station.title;
button.classList.add("linkButton", "btnC-primary", "btnC");
button.setAttribute("data-destination", "#lb"); // Added this line
buttonContainer.appendChild(button);
Full js part:
JavaScript:
const buttonContainer = document.querySelector(".buttonContainerB");
// Create audio and button elements for each station
radioStations.forEach(function(station) {
if (station.src) {
// Create audio element
const audio = document.createElement("audio");
audio.title = station.title;
audio.preload = "none";
const source = document.createElement("source");
source.src = station.src;
source.type = "audio/mpeg";
audio.appendChild(source);
// Add audio element to the body
document.body.appendChild(audio);
// Create button element
const button = document.createElement("button");
button.classList.add("playButtonB", "btnB-primary", "btnB");
button.dataset.src = station.src;
button.textContent = station.title;
// Add button to the container
buttonContainer.appendChild(button);
} else if (station.buttonClass) {
const button = document.createElement("button");
button.className = station.buttonClass;
button.textContent = station.title;
button.classList.add("linkButton", "btnC-primary", "btnC");
button.setAttribute("data-destination", "#lb"); // Added this line
buttonContainer.appendChild(button);
}
});
The 6 Warnings:
Last edited: