• Resolved dinkar9852

    (@dinkar9852)


    i want to add some image for lead generation just below the wrong answer when user select it.

    Example:

    1. Queation Title

    A. Option 1

    B. Option 2

    C. Option 3

    4. Option 4

    Correct answer is (B Option 2) but user click on (C Option 3) just below this option i want to add image for lead generation. I am already using explanation option for wrong answer

    so please guide me how to do this

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

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

    (@harmonic_design)

    Hi again dinkar,
    If I understand correctly, on wrong answer you want to automatically show an image directly underneath the selected wrong answer?

    If so, this is not really possible without completely breaking the formatting and looking ugly (which would be a shame since your quizzes look so nice!).

    Why not just add the image to the Extra text section where you already have your explainer? You can add images or even video to that section

    Thread Starter dinkar9852

    (@dinkar9852)

    tell me how to do but i want on every page automatically not doing manually .

    Plugin Author Harmonic Design

    (@harmonic_design)

    The following code should get you close to what you need.

    function hdq_dinkar9852_after_quiz_extra_text()
    {
    ?>
        <script>
            function hdq_dinkar9852_after_quiz_extra_text() {
                const content = <p><img src = "#####" alt = ""/>;
                const extraText = document.getElementsByClassName("hdq_question_after_text");
                for (let i = 0; i < extraText.length; i++) {
                    extraText[i].insertAdjacentHTML("beforeend", content);
                }
            }
            hdq_dinkar9852_after_quiz_extra_text();
        </script>
    
    <?php
    }
    add_action("hdq_after", "hdq_dinkar9852_after_quiz_extra_text");

    Add that to your theme’s functions.php file (make a backup first!).

    What it does is runs a script that adds the image automatically to the end of each Extra Text section. Update the ##### in the line <code>const content =<p><img src = “#####” alt = “”/>; to the URL of the image you want to add, or replace it with whatever HTML you want.

    Thread Starter dinkar9852

    (@dinkar9852)

    not working

    Plugin Author Harmonic Design

    (@harmonic_design)

    It looks like this forum stripped out a character.

    <p><img src = "#####" alt = ""/></p> is supposed to be wrapped/surrounded in `

    Here is a better formatted version: https://pastes.io/6onbmhj5li

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show image below wrong answer selected by user’ is closed to new replies.