• Resolved moodybits

    (@moodybits)


    How can I force the filter widget to auto-submit? What I want to do is use an ACF field to determine what shows on the page, hide the filter UI, and have the default filter fire automatically on page load

Viewing 1 replies (of 1 total)
  • Plugin Support Dara

    (@dara4)

    Hi @moodybits,

    This can easily be done with a bit of JS that will trigger the submit button on page load.

    The first thing to do is to set your custom field under “Default Filter”, this will force a selection of your choice.
    Under “Additional Option” enable “Display Submit button”, then on your page, load add the following script:

    <script>
    document.addEventListener('DOMContentLoaded', function() {
        // Wait a tiny bit to ensure Elementor and filters are fully loaded
        setTimeout(function() {
            var form = document.querySelector('.form-tax');
            if (!form) return;
    
            var submitBtn = form.querySelector('.submit-form');
            if (submitBtn) {
                submitBtn.click();
            }
    
        }, 500);
    });
    </script>

    The filter can stay hidden, and the results should load immediately when the page opens. Let me know if this solution works for you.

    Regards,
    Dara

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.