window.onload = function(){ addScenario = function(scenario){ let $liElement = $("
") if(scenario.adult == true){ $adultText = $("(question for those over the age of 18... or those mature enough)
"); $liElement.append($adultText); } $description = $("" + scenario.description +"
"); $options = $("" + scenario.question + "
"); $textArea = $("") $liElement.append($description); $liElement.append($options); $liElement.append($textArea); $("#scenarios").append($liElement); } $.getJSON("./resources/questions/scenarios.json", "", function(data){ for(const scenario of data.scenarios){ addScenario(scenario); } }); }