koupuh

artist-tracker javascript

Oct 31st, 2020
692
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function buildOutput(){
  3.     artist_list = document.getElementById("artistInput").value;
  4.     artists = artist_list.split(";");
  5.     artistRows = [];
  6.    
  7.     // remove whitespaces from artist names
  8.     outputTable = document.getElementById("outputTable");
  9.     for (let i = 0; i<artists.length; i++){
  10.         row = makeRow(artists[i]);
  11.         outputTable.appendChild(row);
  12.     }
  13. }
  14.  
  15. function makeRow(artist){
  16.     row = document.createElement("tr");
  17.     artistName = document.createElement("td");
  18.     artistName.appendChild(document.createTextNode(artist));
  19.     row.appendChild(artistName);
  20.    
  21.     newAlbums = ["Cats and Dogs", "Doomed", "Entres R Us"] // currently dummy data
  22.     //get list of new albums
  23.     // albs = artistlookup()
  24.     for (let i = 0; i<newAlbums.length; i++){
  25.         alb = document.createElement("td")
  26.         alb.appendChild(document.createTextNode(newAlbums[i]))
  27.         row.appendChild(alb)
  28.     }
  29.     return row
  30. }
  31.  
  32. function artistLookup(artist){
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
RAW Paste Data