Add

Lorem ipsum

Lorem ipsum

A
A
A
Design

0 views

4 min

How to Show and Hide Elements on Click in Webflow

Learn how to show and hide elements on click in Webflow with native interactions or JavaScript.

In this tutorial, Sandro, co-founder of the Gemeos Webflow agency, shows you how to show and hide elements on click in Webflow, using native interactions or JavaScript.

Example

Here’s the hidden content. It appears with a smooth animation thanks to max-height and opacity, with no extra JavaScript needed for the animation.
MethodBenefitWhen to use it
Webflow Interactions (Toggle)No code, visible in the DesignerSimple cases, 1 element
JavaScript classList.toggleMore controlMultiple linked elements
CSS :checked (input hidden)No JSAccordions, simple tabs

Method 1: Webflow Interactions

Select the trigger button. In Interactions, create a Mouse click (tap) trigger. Add the Display action to the target element, with the Toggle option. This is the fastest method for a simple case.

Method 2: JavaScript with classList.toggle

For more complex cases (multiple elements, CSS animations), use this approach:

document.querySelector('.toggle-btn').addEventListener('click', function() {
document.querySelector('.toggle-content').classList.toggle('visible');
this.classList.toggle('active');
});

With the matching CSS:

.toggle-content { display: none; }
.toggle-content.visible { display: block; }
.toggle-btn.active { background: #333; color: #fff; }

good to know

To animate the reveal (fade-in) instead of an abrupt display, replace display: none/block with opacity: 0/1 plus visibility: hidden/visible and a CSS transition. display: none removes the element from the flow and prevents direct CSS transitions, while opacity + visibility allows them.

Conclusion

Show/hide on click is one of the most commonly used interactions. Use cases:

  • Show more details on a product card
  • Show/hide an extra form
  • Filter toggles on a listing page

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...