Inserting value of array in a <p> element
Hey all. Can someone help me to get the value of the array playlistArray into the new <p> that I create in the function updatePlaylist? Beneath is one of my failed attempts to get it to work. If I want to add a variable in line 6 it will handle it as a string as its between quotation marks.
- var playlistArray =["blablabla", "blbublubl"];
- updatePlaylist = function() {
- for(var i = 0; i < playlistArray.length; i++) {
- var newListItem = $("playlistArray[i]").val();
- var newListP = $("<p class=playlistItem></p>")
- newListP.append(newListItem);
- newListP.appendTo("aside");
- }
- }