Is there a way to start the quiz directly without “NEXT”?

closed

Hi, I started to use you plug-in. Very well done! Thanks. I am going to buy the addon but before, I was wondering if it was possible to start the embed quiz directly without clicking on next. Thank you

March 6, 2024 at 3:38amcarole

Hi Carole,
Quizzes only start with the next button if your first question has paginate enabled.

Just uncheck paginate from your first question and you’ll be good to go.

The only exception is of you are using random question order. Let me know if you are and I can send you some custom code to auto click the next button on load.

06 March 2024 — 22:41support admin Dylan

Ah perfect. Thank you for you quick answer. Just benchmark all the other solutions and yours is perfect for my project! Happy to see that you are so reactive with support. Will I get a receipt when I buy the addons? thank you in advance

You sure will!

You will get an order email confirmation will all relevant information. The order page itself will also contain all the info you need. You can print the order page (it has a custom print view) or “print to pdf” as needed.

07 March 2024 — 17:47support admin Dylan

Hello Dylan, do you still have the custom code to auto click the “next” button on load available? I ran into the same issue as Carole but I have the random question order enabled. Thanks a lot!

@Martin,
the following code should work. Just note that this assumes that ALL of your quizzes will have the first question paginated. This code will always click the first next button on quiz load, regardless of where that next button may be located.

function hdq_add_first_next_click_init_action($data)
{
    array_push($data->hdq_init, "hdq_auto_click_first_next_button_when_random");
}
add_action("hdq_init", "hdq_add_first_next_click_init_action", 10, 1);

function hdq_auto_click_first_next_button_when_random()
{
?>
    <script>
        function hdq_auto_click_first_next_button_when_random() {
            const jPaginateEls = document.getElementsByClassName("hdq_next_button");
            if (jPaginateEls.length == 0) {
                return;
            }
            jPaginateEls[0].click();
        }
    </script>
<?php
}
add_action("hdq_after", "hdq_auto_click_first_next_button_when_random");

The first function tells HD Quiz to run a JavaScript function once HD Quiz has loaded. The second function is the actual function that auto clicks the first next button.

This code should be added to your theme’s functions.php file. BACK UP THE FILE FIRST

20 June 2024 — 11:24support admin Dylan

This thread has either been marked as complete or has been automatically closed due to inactivity. Please consider opening a new support thread for help.