How to clear all fields of a Webflow form

Bjorn Krolsavatar

Bjorn Krols

Published on
29 November 2021

This brief post explains how to clear all fields of a Webflow form.

⚡ Looking for a form provider for your exported Webflow sites? Check out Formspark.

Inside the Webflow designer

  1. Drag and drop a Form Block element.
  2. Drag and drop a Button element.
  3. Give the button element an ID (such as "reset").

We will be interacting with the HTML code Webflow generates for its forms, which looks approximately like this (abridged):

<!DOCTYPE html>
<html lang="en">
    <form data-name="Email Form">
      <input type="text" name="name" />
      <input type="email" name="email" />
      <input type="submit" value="Submit" />
      <a href="#" id="reset">Reset</a>
  1. Find the name of your form.
  2. Copy-paste the following code into your page's Before body tag Custom Code section:
  $("#reset") // <- Replace "#reset" with your button id (keep the #)
    .click(function (e) {
      var formElement = $('form[data-name="Email Form"]'); // <- Replace "Email Form" with your form name
      var inputElements = formElement
        .not(":button, :submit, :reset, :hidden");
      inputElements.val("").prop("checked", false).prop("selected", false);

Note: we are using jQuery because Webflow includes it by default, and its usage has been widely adopted by the Webflow community.

Don't forget to save and publish your page.

Subscribe to our newsletter

The latest news, articles, and resources, sent to your inbox weekly.

More like this