Webflow sync, pageviews & more.
NEW

What could be the problem with hiding a text field in Webflow using the <input class="hidden"> or <input type="hidden"> tags, as it is not working even after publishing?

TL;DR
  • Use Webflow’s native Hidden input type for form submissions, or manually create a class like "hidden" and set its display to "none" in the Designer.
  • Ensure changes are published, clear browser cache if needed, and use Embed elements if inserting custom HTML.

You're trying to hide a text field in Webflow using either class="hidden" or type="hidden", but it's not behaving as expected even after publishing. Here's what you need to know.

1. Difference Between type="hidden" and class="hidden"

  • type="hidden": This attribute correctly hides the input from the browser’s view. It won’t be rendered visibly on the page for users but still sends data when you submit a form.
  • class="hidden": This is just a CSS class and must be styled manually in Webflow (e.g., setting display: none). If no CSS is applied, it won't hide anything.

2. Issues Using class="hidden" Without Proper Styling

  • In Webflow, adding a class called hidden alone doesn't automatically hide the element.
  • You must create a class named "hidden" (or any name) and then set its display property to "none" in Webflow’s Designer.
  • Without this, the element remains visible on the page.

3. How to Properly Add type="hidden" Fields in Webflow

  • Go to your Form Block in the Designer.
  • Add a Form Input element.
  • Set the input's Type to "Hidden" via the Input Settings panel.
  • Do not use a visible text input and simply rely on CSS to hide it if you intend it to be a true hidden form field.

4. Why it's Not Working Even After Publishing

  • If you used class="hidden" but forgot to apply any "display: none" styling, the field would still be visible.
  • If you manually tried to insert raw HTML for a hidden input, Webflow may sanitize or modify it unless used in an Embed element.
  • If caching issues occur, sometimes old versions might display despite updates; clear browser cache or use incognito mode to test.

5. Solutions

  • Use Webflow’s native Hidden input field if you need the field for form submissions.
  • If using a custom class, make sure to define the 'hidden' class with Display: None styling.
  • Check Publishing: Ensure you clicked Publish to Selected Domains after making changes.

Summary

To hide a field correctly in Webflow, either set the input type to "hidden" via the Designer settings or, if using a CSS class like hidden, make sure the class explicitly sets display: none. Using just class="hidden" without CSS won't automatically hide anything.

Rate this answer

Other Webflow Questions