Support » Plugin: HD Quiz » # on each question

  • Resolved johnsiii88

    (@johnsiii88)


    I have a quiz with one question. Is there a way to not have it add the #1 to the front of the question and to not put 1/1 under the word results when it displays the answer?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    Hi johnsiii88,
    I have bad news, but then good news!

    The bad is that there is no easy way to do this right now, although it is possible.

    The good news, is that this will be a lot easier when the new version of HD Quiz is realsed.

    If you can wait for the new version, just add the following CSS to your style sheet.

    .hdq_question_number, .hdq_result {display: none;}. If you do that, then the numbers will automatically hide when you update to the next version.

    However, if you don’t want to wait, you can add the following jQuery to your site (either add it to a script, or just add to your theme’s footer.php).

    
    <script>
    jQuery(document).ready(function() {
      jQuery(".hdq_question h3").each(function() {
        let hdq_title = jQuery(this).html();
        hdq_title = hdq_title.split("#");
        if (hdq_title.length === 1) {
          // question as a title
          hdq_title = hdq_title[0];
        } else {
          // numbered question
          hdq_title = hdq_title.join("#");
          hdq_title = hdq_title.split(" ");
          let hdq_title_new =
            '<span class = "hdq_question_number">' + hdq_title[0] + "</span> ";
          hdq_title.shift();
          hdq_title = hdq_title.join(" ");
          hdq_title = hdq_title_new + hdq_title;
        }
        jQuery(this).html(hdq_title);
      });
    });
    </script>
    <style>.hdq_question_number, .hdq_result {display: none}</style>
    
    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.