I am having difficulty figuring out how to populate an array with different values from HTML select options.
In the HTML I have a select dropdown:
<select id="Playlist">
<option value="trance">TRANCE</option>
<option value="house">HOUSE</option>
</select>
And I would like to populate a "songs" array of objects with different values depending on which option is selected.
for "HOUSE", the songs would be
let songs = [
{
musicFile: "./music/mp3/Lasgo - Something .mp3",
thumbnail: "./music/art/Lasgo - Something .jpg",
contributor: " ",
artist: "Lasgo",
title: "Something",
subtitle: " ",
comment: "featuring Jelle van Dael"
},
{
musicFile: "./music/mp3/Mason - You Are Not Alone .mp3",
thumbnail: "./music/art/Mason - You Are Not Alone .jpg",
contributor: " ",
artist: "Mason",
title: "You Are Not Alone",
subtitle: " ",
comment: "featuring Róisín Murphy"
}]
or if "TRANCE" is the selected option, the same array world have different values
let songs = [
{
musicFile: "./music/mp3/Aalto - Rush (Super8 vs Orkidea Remix) .mp3",
thumbnail: "./music/art/Aalto - Rush (Super8 vs Orkidea Remix) .jpg",
contributor: " ",
artist: "Aalto",
title: "Rush",
subtitle: "(Super8 vs Orkidea Remix)",
comment: " "
},
{
musicFile: "./music/mp3/Above & Beyond - 1001 .mp3",
thumbnail: "./music/art/Above & Beyond - 1001 .jpg",
contributor: " ",
artist: "Above & Beyond",
title: "1001",
subtitle: " ",
comment: " "
}]
I've tried several techniques from google searching, but I can't seem to get it working.
songsarray to other arrays like, whenhouseis selected set thesongstohouse_songsvariable? Or am i missing something?