I want to select the "artist"
and put it in the selector and I want to keep it in vannila javascript.
I thought this would select the artist from my JSON file.
option.text = data[i].artist;
My JSON
{
"Albums": {
"Krezip": [
{
"artist":"Krezip",
"title":"Days like this",
"tracks": [
{
"title":"Lost without you",
"src":"https://www.youtube.com/embed/zazrmePIL9Y",
"dur":"3:35"
},
{
"title":"I would stay",
"src":"https://www.youtube.com/embed/kfrGFGHU6YA",
"dur":"4:04"
}
]
}
],
"Cure": [
{
"artist":"The Cure",
"title":"Wish",
}
]
}
}
And my javascript
const data = JSON.parse(request.responseText);
let option;
for (let i = 0; i < data.length; i++) {
option = document.createElement('option');
option.text = data[i].artist;
dropdown.add(option);
}