How can I close the popup when an Elementor Form is successfully submitted?

To automatically close your FireBox popup whenever an Elementor Form that’s embedded into your campaign is submitted successfully, follow the steps listed below:

Step 1: Add a unique Form ID into your Elementor Form

Your page may contain multiple Elementor forms, however, we only want to close the FireBox popup only when the form that’s embedded into the campaign is successfully submitted.

Edit your campaign with Elementor > select your form > click on the “Additional Options” tab, and set a unique Form ID under “Form ID”, as seen below:

Save the changes and go back to the FireBox editor.

Step 2: Add Custom Javascript to hide the popup on form submit

Once you’re on the FireBox editor, go to Advanced > Custom Javascript and add:

jQuery( document ).ready(function( $ ){
    jQuery( document ).on('submit_success', function(e){
        if (e.target.closest('#myFormId')) {
            const campaign = FireBox.getInstance({fpf fb.id});
            campaign.close();
        }
    });
});
  • Replace myFormId with the Form ID you added previously to your Elementor form.

Now, whenever the form is submitted, the campaign will automatically close.

Was this helpful?