quiz_master_next icon indicating copy to clipboard operation
quiz_master_next copied to clipboard

Dynamically add class for correct/incorrect answers not working

Open sriordan9 opened this issue 6 years ago • 4 comments

General description

There may be a bug for the option to dynamically add class for correct/incorrect answers. Did not add a class when option was checked.

Feature request

User would like to be able to use css to color correct/incorrect answers as they are clicked during quiz. User email: "i need to assign css to correct and wrong answers... I want when the correct answer clicked to turn green or turn red if the answer is wrong"

sriordan9 avatar Mar 07 '18 21:03 sriordan9

Ah! Did some testing with this and see what happened. This must have broke in 5.2. Here is the event listener that is attached when that option is enabled:

https://github.com/fpcorso/quiz_master_next/blob/master/js/qmn_quiz.js#L308

Inside that event listener, we get the question ID and selected answer. We then cycle through the questions:

https://github.com/fpcorso/quiz_master_next/blob/master/js/qmn_quiz.js#L312

The issue is that the question_list key does not exist in that object. It used to though. That key is created in our older answer system for some reason. Not sure why I put it there but that explains why I didn't think of it. So, the pagination system no longer uses the older answer system so that key does not get created leading to this feature not working.

fpcorso avatar May 03 '18 01:05 fpcorso

Another user has requested a fix for this

sriordan9 avatar Jul 20 '18 20:07 sriordan9

Another user has requested that this bug be resolved

sriordan9 avatar Aug 15 '18 20:08 sriordan9

Another user has requested a fix for this

Nic72 avatar Dec 14 '22 11:12 Nic72