HD Quiz

Need to send invoices?
Check out my new WordPress plugin HDInvoice
Limited time launch sale

Hello, shall we create logical options which means, when…

Published: August 31, 2022
Support status: closed

Hello,

shall we create logical options which means, when I use pagination, then if the answer is correct then go to next question, or if the answer is wrong then leave it on that page.

This thread has been imported from harmonicdesign.ca/hd-quiz/

thread author: Akhil S

Hi Akhil,
This is possible but would require you to edit the plugin directly.

For quiz settings, I recommend setting the following:

Enable “Immediately mark answer as correct or incorrect” (under marking tab)
Enable the Timer per question (this will stop users from skipping questions).

Now edit the plugin. File ./hd-quiz/includes/js/hdq_script.js. On line 454 you will see return correct. Above this line, add in the following new code.

if (!correct) {
HDQ.VARS.timer.active = false;
document.getElementsByClassName("hdq_results_wrapper")[0].style.display = "block";
document.getElementsByClassName("hdq_result_fail")[0].style.display = "block";
let q = document.getElementsByClassName("hdq_question");
while (q.length > 0) {
q[0].remove();
}
let b = document.getElementsByClassName("hdq_button");
while (b.length > 0) {
b[0].remove();
}
setTimeout(function () {
HDQ.scroll();
}, 1000);
}

What the code will do is detect when a question was answered incorrectly, and then immediately end the quiz. Just note that this will only work for the default multiple choice question type. Additions will be needed for it to work with other question types too.

01 September 2022 — 11:30 support admin - Dylan

If you are enjoying HD Quiz please leave a review here on the official WordPress.org page. HD Quiz is developed by me, just some dude, and is supported and available for free. It may seem dumb, but truly nothing makes me happier than knowing that people are using and loving HD Quiz and my hard work.

This thread has either been marked as complete or has been automatically closed due to inactivity.