jewlofthelotus / SlickQuiz

A jQuery plugin for creating pretty, dynamic quizzes.
http://jewlofthelotus.github.com/SlickQuiz
MIT License
400 stars 244 forks source link

Answer is highlighted #64

Open fishingman opened 9 years ago

fishingman commented 9 years ago

In slickquiz.js,

preventUnanswered: true, tryAgainText: 'tryagain', perQuestionResponseMessaging: true,

Is set as, after finished answer the quiz, and are solved again quiz, if nothing was answer without selecting a choice, will somehow correct answer is highlighted. We appreciate your prompt attention to this matter.

default

1

2

4

jewlofthelotus commented 9 years ago

@fishingman can you confirm that you have the latest version of SlickQuiz? v1.5.20? It would say at the top of the slickquiz.js file.

fishingman commented 9 years ago

I was able to confirm the version of Slickquiz. Version of slickquiz that bug has occurred is the latest 1.5.20.

louposk commented 9 years ago

You can move the following lines of code:

// Collect the answers submitted
                var selectedAnswers = [];
                answerSelects.each( function() {
                    var id = $(this).attr('id');
                    selectedAnswers.push(parseInt(id.replace(/(.*\_question\d{1,}_)/, ''), 10));
                });

                 if (plugin.config.preventUnanswered && selectedAnswers.length === 0) {
                    alert(plugin.config.preventUnansweredText);
                    return false;
                }

after this (around line 429):

answerLIs.addClass(incorrectResponseClass);

This one, first check if the option is check and if it passes then it collects the true answers. This worked for me.