Skip to main content

Automatically go to the next step when a visitor selects an option

Skip the "Next" button in multi-step forms by advancing as soon as a visitor picks a radio option.

Written by Rafael Gonzales

In a multi-step form, visitors usually have to click a button to move to the next step. If a step only has a radio button question, you can advance them automatically as soon as they make a choice.

Add the JS callback

  1. Open your campaign in the builder.

  2. In the left menu, select JS callbacks.

  3. Create a new callback linked to the Before popup display event.

  4. Paste the following code:

    const form = event.target.querySelector('.wisepops-content form');

    if (form) {
    form.addEventListener('input', (event) => {
    if (event.target.type === 'radio' && event.target.value !== undefined) {
    const cta = form.querySelector('button');
    if (cta) {
    cta.click();
    }
    }
    });
    }
  5. Save your campaign.

When a visitor selects a radio option, the code clicks the step's button for them.

Hide the button (optional)

If every step in your form only has radio questions, you can hide the button completely with this CSS:

.wisepops-block-signup button {
display: none;
}

Only use this if all your steps are radio-only. If a step has other field types, like text or email, visitors will need the button to continue.

Test it

JS callbacks don't run in the campaign editor. Use a live preview on your website to check that it works.

Did this answer your question?