var jsonData = []; fetch('../../story/database.json') .then(response => response.json()) .then(data => {jsonData = data;createHTML();}); function createHTML() { for (i in jsonData) { $("body").append( $(`
${jsonData[i].id}

Characters ${repeat(jsonData[i].appearing_characters.length, (bruh) => { return `
${jsonData[i].appearing_characters[bruh][1]}

` })}
`) ); } $(".nameOfThing").change((eo) => { console.log($(eo.currentTarget)); $( eo.currentTarget ).parent().find("legend").text(eo.currentTarget.value); }) } function repeat(n, f) { var returnVal = ""; for (var i = 0; i < n; i++) { returnVal += f(i); } return returnVal; }