Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jhgk #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2>Test your knowledge</h2>
<button type="button" class="btn btn-primary" id="btnSubmit">
Submit Quiz
</button>
<button type="button" class="btn btn-primary" id="btnReset">
<button type="button" class="btn btn-primary" id="btnReset" onClick= "document.location.reload(true)">
Reset Quiz
</button>
<span id="score"></span>
Expand Down
22 changes: 21 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ window.addEventListener('DOMContentLoaded', () => {
o: ['Sydney', 'Canberra', 'Melbourne', 'Perth'],
a: 1,
},
{
q: 'What is the biggest animal on Earth?',
o: ['Elephant', 'Giraffe', 'Blue Whale', 'Sperm Whale'],
a: 2,
},
{
q: 'What is the fastest animal on Earth?',
o: ['Bluefin Tuna', 'Cheetah', 'Gazelle', 'Peregrin Falcon'],
a: 3
}
];

// function to Display the quiz questions and answers from the object
Expand Down Expand Up @@ -79,12 +89,22 @@ window.addEventListener('DOMContentLoaded', () => {
}

if (radioElement.checked) {
// code for task 1 goes here
score++
}
}
});
};
//Couldn't figure out where to put eventListner.
//const submit = document.querySelector('#btnSubmit');
//submit.addEventListener('click', function () {
//clearInterval(timer);
//calculateScore();
//};



// call the displayQuiz function
displayQuiz();
});