quiz_master_next
quiz_master_next copied to clipboard
Dynamically add class for correct/incorrect answers not working
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"
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.
Another user has requested a fix for this
Another user has requested that this bug be resolved
Another user has requested a fix for this