As a beginner in this realm, I must apologize if my query seems naive.
I recently crafted a multiple-choice quiz using HTML, CSS, JavaScript (angular.js), and a JSON data file following a tutorial I stumbled upon. The outcome pleased me, but now I am faced with the task of enabling users to select more than one correct answer for each question. How can I achieve this functionality? Do I simply need to designate multiple correct answers in the JSON file?
Your guidance is greatly appreciated!
Below is a snippet of my code:
HTML:
<!DOCTYPE HTML>
<html ng-app="myQuiz">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test Your Knowledge: Saturn</title>
<link rel="stylesheet" type="text/css" href="css/quiz.css">
</head>
<body>
...
JSON (multiple questions included - formatted as shown:
[{
"question" : "What is the name of Saturn's largest moon?",
"answers" : [
{"id" : 0, "text" : "Hercules"},
{"id" : 1, "text" : "Europa"},
{"id" : 2, "text" : "Goliath"},
{"id" : 3, "text" : "Zeus"},
{"id" : 4, "text" : "Titan"},
{"id" : 5, "text" : "Triton"}
],
"correct" : 4,
"feedback" : "Though the names seem similar, Triton orbits the planet Neptune."
}]
JavaScript
(function(){
var app = angular.module('myQuiz',[]);
app.controller('QuizController'['$scope','$http','$sce',function($scope,$http,$sce){
...