Streaming live at 10am (PST)

How to refresh page on form submit (for only one form)

How do assign this function to one specific webflow-form on a page correctly?

Form class: dashboard-form

do you wrap it in? --> If ( $(".dashboard-form")) {}

<script>
Webflow.push(function() {
  $(document).on('submit', 'form', function() {
    // Refresh page after 1000 milliseconds
    setTimeout(function() { location.reload(true); }, 1000);
  });
});
</script>

Hey @HappyDigital,

You’re super close. Just need to assign an ID to the form element and change your code from $(document).on… to $('refreshThis').on… where the refreshThis ID is added to the form element itself.

The code would then be:

<script>

var Webflow = Webflow || [];
Webflow.push(function () {

    $("#refreshThis").submit(function (event) {
        setTimeout(function () { location.reload(true); }, 1000);
    });

});

</script>

I created this cloneable project for you (and others) to see how it’s done. Hope it helps!

2 Likes

Hi Mattvaru!

You’re the best! Thanks for reaching out, much appriciated!

Cheers!

1 Like