Title: Answer for every question
Last modified: September 23, 2019

---

# Answer for every question

 *  Resolved [gattamelata](https://wordpress.org/support/users/gattamelata/)
 * (@gattamelata)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/)
 * Is there a way to display the answers (wrong/correct) and the “wrong” texts for
   every question instead of at the end?
 * Thank you
 * m

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11961090)
 * Hi gattamelata, this can be done by adding some custom javascript.
 * How comfortable are you with editing your theme? If I sent you some code, would
   you be able to add it to your theme’s functions.php file?
 *  Thread Starter [gattamelata](https://wordpress.org/support/users/gattamelata/)
 * (@gattamelata)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11961101)
 * Yep, i think i can handle it.
    I’ll need to do it on a child theme i suppose.
   Thanks a lot
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11964025)
 * Great, I’ll send you what you need and instructions soon
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11964550)
 * Here is what we need to do.
    1. Deactivate and delete HD Quiz (you will not lose any quiz data)
    2. [Download, upload, and activate](https://harmonicdesign.ca/plugins/hd-quiz/1.6.1/hd-quiz.zip)
       the beta version here.
    3. Edit `functions.php` of your theme (or child) and paste in the below code
    4. clear your cache to ensure latest files load
 *     ```
       function hdq_before_test($quizID)
       {
           ?>
       	<script>		
       		jQuery(window).load(function() {
       			// when an answer is selected
       			jQuery(".hdq_label_answer").click(function(){
       				// check if this question has already been answered
       				let p = jQuery(this).parent().parent();
       				if(jQuery(p).hasClass("hdq_answered")){
       					return false;
       				} else {
       					jQuery(p).addClass("hdq_answered");
       					// check to see if answer was right
       					console.log(jQuery(this))
       					if(jQuery(this)[0].children[0].children[0].value == 1){
       						jQuery(p).addClass("hdq_answered_correct");
       						jQuery(this).addClass("hdq_correct");
       					} else {
       						jQuery(p).addClass("hdq_answered_incorrect");
       						jQuery(this).addClass("hdq_wrong");
       					}
       					jQuery(p).find(".hdq_question_after_text").fadeIn();
       				}
       			});
       		});
       	</script>
       <?php
       }
       add_action('hdq_before', 'hdq_before_test');
       ```
   
 * The beta version I had you download includes custom actions and hooks. The one
   we are using allows us to insert any custom code to the start of each quiz load.
   We could have inserted the same jQuery to your footer.php file directly without
   the beta version, but then the code would be on all pages instead of just ones
   with a quiz on it.
 * What the above javascript code does is first check to see if an answer is selected.
   It then marks the question as “complete” so that changing your answer will not
   do anything. It will then mark the answer as correct or incorrect, and display
   the additional information if there was any.
 * Please note that although the above code will work for your purposes, it’s not
   perfect (for example, you still have to select “finish” to see your full results),
   but it should be more than enough to get you on the right track.
 *  Thread Starter [gattamelata](https://wordpress.org/support/users/gattamelata/)
 * (@gattamelata)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11966306)
 * Wow,
    thank you mate, I owe you a favor.
 * m
 *  Thread Starter [gattamelata](https://wordpress.org/support/users/gattamelata/)
 * (@gattamelata)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11971860)
 * It’s working great.
    The only problem in that now every time i update a question
   it is displayed like this:
 * ■ quando-avviene-la-maggior-parte-dei-furti?
 * instead of:
 * ■ quando avviene la maggior parte dei furti?
 * Is there something i can do?
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-11975490)
 * Hi gattamelata,
    this may be a bug in the beta version. A fix will be released
   very soon for it!
 *  Thread Starter [gattamelata](https://wordpress.org/support/users/gattamelata/)
 * (@gattamelata)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-12009072)
 * Hi,
    any news?
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-12009458)
 * Yup!
 * The release will be this weekend – keep an eye out for it!
 *  [Henry](https://wordpress.org/support/users/henrychea/)
 * (@henrychea)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-12091546)
 * Hi Harmonic, is there a way to show the right answer as well if you get it wrong,
   I think this feature is awesome btw

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Answer for every question’ is closed to new replies.

 * ![](https://ps.w.org/hd-quiz/assets/icon-256X256.gif?rev=2936040)
 * [HD Quiz](https://wordpress.org/plugins/hd-quiz/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hd-quiz/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hd-quiz/)
 * [Active Topics](https://wordpress.org/support/plugin/hd-quiz/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hd-quiz/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hd-quiz/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [Henry](https://wordpress.org/support/users/henrychea/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/answer-for-every-question/#post-12091546)
 * Status: resolved