const root = $('#editor-root') var data = [ { "type": "question", "q_no": 3, "text": "The ball is gathered by the defensive division and a player throws it forward, hitting the korf in the other division.", "options": [ "Play on", "Opposite team restart under their defensive post", "Opposite team restart where the ball was thrown from" ], "correct": 0, "q_type": "Multiple Choice", "tags": [ "scoring from the defence zone" ] }, { "type": "question", "q_no": 4, "text": "At the end of the game, after the final whistle, a coach loudly confronts the referee. What can the referee do?", "options": [ "Ignore the coach as the match has ended", "Ignore the coach or inform the coach they will be reported", "Ignore the coach, inform the coach they will be reported and/or show the coach a card" ], "correct": 2, "q_type": "List", "tags": [ "discipline" ] }, ] for (var i = 0; i < data.length; i++) { if (data[i]['type'] == 'question') { var obj = `

${data[i]['text']}
  • ${data[i]['options'].join("
  • ")}
` root.append(obj) } } $('.panel-control').click(function(event) { console.log($(this).data('id')) var id = $(this).data('id') $(`#i${id}`).remove() })