How to pre-fill Webflow form input fields at page load

Bjorn Krolsavatar

Bjorn Krols

Published on
15 November 2021

This brief post explains how to pre-fill Webflow form input fields at page load.

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

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" id="name" />
      <input type="email" id="email" />
      <input type="submit" value="Submit" />
  1. Find the name of your form.
  2. Find the ids of the input fields you want to pre-fill.
  3. Copy-paste the following code into your page's Before body tag Custom Code section:
  // 1. Find the form
  var form = $('form[data-name="Email Form"]'); // <- Replace "Email Form" with your form name
  // 2. Update the values of the inputs
  form.find($("#name")).val("John Doe"); // <- Replace "#name" with your input id (keep the #)

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