skip to Main Content

I have a multi step form in Elementor with radio input, and I want to move to the next step when clicked in radio, now I need to click NEXT to move to next page, 2 clicks to move ahead, but I want just one..

Is that possibe to move automaticly afer clicked in radio option to the next step?

I doens’t understant java scritp to do this if someone can help me I’ll appreceate

2

Answers


  1. write onclick on radio input same as Next button

    Login or Signup to reply.
  2. I did it, this is my Vanilla Javascript code to auto click ‘Next’ when you click on a radio:

    <script>
    document.addEventListener('DOMContentLoaded', function () {
            document.querySelectorAll('.elementor-field-option input[type="radio"]').forEach(radio => {
                radio.addEventListener('click', () => {
                    const nextButton = radio.closest('.elementor-field-group').nextElementSibling.querySelector('.e-form__buttons__wrapper__button-next');
                    if (nextButton) {
                        nextButton.click();
                    }
                });
            });
    });
    </script>
    

    If you also want to auto click on ‘Send’ at the end of the form, you can use this script:

    <script>
    document.addEventListener('DOMContentLoaded', function () {
        document.querySelectorAll('.elementor-field-option input[type="radio"]').forEach(radio => {
            radio.addEventListener('click', () => {
                const currentFieldGroup = radio.closest('.elementor-field-group');
                const nextButton = currentFieldGroup.nextElementSibling?.querySelector('.e-form__buttons__wrapper__button-next');
    
                if (nextButton) {
                    nextButton.click();
                } else {
                    const submitButton = document.querySelector('.elementor-field-group.elementor-field-type-submit button[type="submit"]');
                    if (submitButton) {
                        submitButton.click();
                    }
                }
            });
        });
    });
    </script>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search