Skip to content

Commit

Permalink
Try to fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyEye-FAST committed Jul 11, 2024
1 parent 6503663 commit 34e5478
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions static/js/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ $(document).ready(function () {
$("#inputBox").on("input", updateBoxes);

$("#inputBox").on("input", function () {
updateBoxes();

const input = $(this).val();
const currentKey = questionKeys[currentQuestionIndex];
const correctAnswer = questions[currentKey].translation;

if (input === correctAnswer) {
for (let i = 0; i < correctAnswer.length; i++) {
const box = $("#box" + (i + 1));
box.css("background-color", "#79b851");
}
if ((currentQuestionIndex + 1) === questionKeys.length) {
setTimeout(() => {
showSummary();
Expand Down

0 comments on commit 34e5478

Please sign in to comment.