How to Show or Hide a Section on Click in Elementor

A button that reveals a hidden details section when clicked

Key Takeaways

  • Elementor has no dedicated control to show or hide a section on click, so the three working methods are the Accordion widget, a content toggle widget and a button with a short script.
  • The Elementor Accordion widget hides any widgets inside an item until its title is clicked, and Default State set to All collapsed keeps the item closed on page load.
  • The Master Addons Toggle Content widget works as a show and hide switch when one of its two options is left empty and the other holds the section.
  • A button can show or hide any Elementor container with about ten lines of JavaScript in an HTML widget, using one CSS class on the button and one on the container.
  • Elementor Display Conditions and the Responsive hide settings do not react to clicks, because they decide what shows by rule or by device before the visitor does anything.

To show or hide a section on click in Elementor, put the section inside something that opens when clicked. The Accordion widget does this with no extra plugin. A content toggle gives you a Show and Hide switch. A button with a few lines of script can reveal any container on the page. Elementor does not have a single “show on click” setting, so one of these three is the route.

Each method below was built and tested on Elementor 4.3. Pick by how the trigger should look: a title bar, a switch or a button.

Which method fits your page

All three methods hide a section until a click. They differ in what the visitor clicks and how much setup they need.

AccordionContent toggleButton and script
What visitors clickA title barA Show and Hide switchAny button or icon
Hidden content sitsInside the widgetInside the widget, or in a saved templateAnywhere on the page
Code neededNoneNoneAbout ten lines
NeedsElementorMaster Addons ProElementor
Best forExtra details, FAQs, Read MoreA clear on and off choiceA button far from the section it opens

Method 1: The Accordion widget

The Accordion widget is the quickest way to show a section on click, because each item is a container that accepts any widget. Whatever you put inside stays hidden until the title is clicked.

  1. Edit the page with Elementor and drag the Accordion widget to where the hidden section should be.
  2. Delete the items you do not need. For one hidden section, keep one item.
  3. Type the title visitors will click, such as Show delivery details.
  4. Click inside the item and add your content: text, images, a form or a whole container layout.
  5. Open Interactions and set Default State to All collapsed.
Elementor Accordion widget with all three items collapsed, hiding the content until a title is clicked
All collapsed: nothing shows until a title is clicked.
Elementor Accordion widget with two items clicked open and their content showing
After two clicks. Set Max Items Expanded to Multiple if several should stay open.

The limit of this method is the look. The trigger is always a title bar directly above the content. If you need a styled button, or a trigger somewhere else on the page, use Method 3. For more title styles, the Advanced Accordion widget is an option.

Method 2: A content toggle with an empty option

A content toggle normally switches between two blocks. Leave one block empty and it becomes a show and hide switch: one label shows nothing, the other shows your section.

These steps use Toggle Content from Master Addons Pro. We tested the empty option on Elementor 4.3 and it leaves no gap or placeholder.

  1. Drag Toggle Content onto the page.
  2. In the Elements list, label the first item Hide details and delete the sample text so its content is empty.
  3. Label the second item Show details. Write the content in the editor, or set Type to Template and pick a saved template for a full layout.
  4. Open Toggle Settings and leave Active Index on 1, so the page loads with the section hidden.
  5. Set Position to Before if the switch should sit above the section, or After to put it below.
Toggle Content switch set to Hide details with nothing showing below it
Hide details is active and its content is empty, so nothing shows.
Toggle Content switch set to Show details with a delivery details paragraph showing below it
One click on Show details reveals the section.
Toggle Settings section of the Toggle Content widget with Active Index set to 1, Position set to Before and Indicator Speed
Active Index 1 keeps the empty option as the default.

The switch makes the state obvious, which suits optional details such as nutrition facts, technical specs or terms. To flip it the other way, with the section visible first, set Active Index to 2.

Switching between two sections? The Toggle Content widget page has billing switches, spec tables and eight more live demos.

Method 3: A button and a short script

Use a script when the trigger must be a normal button, or when the button and the section are in different places. You add one CSS class to the button, one to the section, and paste a small snippet into an HTML widget.

  1. Add a Button widget. In Advanced > CSS Classes, type show-hide-button. Leave the button’s link field empty.
  2. Select the container you want to hide. In Advanced > CSS Classes, type show-hide-target.
  3. Drag an HTML widget anywhere on the page and paste the code below.
  4. Update the page and test it on the front end.
<style>
.show-hide-target { display: none; }
.show-hide-target.is-open { display: flex; }
.elementor-editor-active .show-hide-target { display: flex; }
</style>

<script>
document.addEventListener("DOMContentLoaded", function () {
  document.querySelectorAll(".show-hide-button a, .show-hide-button button").forEach(function (button) {
    button.addEventListener("click", function (event) {
      event.preventDefault();
      document.querySelectorAll(".show-hide-target").forEach(function (target) {
        target.classList.toggle("is-open");
      });
    });
  });
});
</script>

The first style rule hides the container. The second shows it once the script adds the is-open class. The third keeps the container visible inside the Elementor editor, so you can still edit it. Each click on the button adds or removes the class.

Elementor button labelled Show shipping details with the target container hidden
Before the click: only the button shows.
The same Elementor button after a click, with the shipping details container now showing below it
After the click, the container with the class show-hide-target appears.

Three notes on this method. Every container with the class opens together, so use different class names if you need separate pairs on one page. The button text does not change by itself. And if a caching or script optimisation plugin delays JavaScript, the first click can be ignored until the script loads.

If the section should open over the page, use a popup. See how to add a popup in Elementor.

What does not work: Display Conditions and Responsive settings

Two Elementor features sound like they should do this and do not. Both hide content, but neither reacts to a click.

  • Responsive settings. Advanced > Responsive has Hide On Desktop, Hide On Tablet and Hide On Mobile. They hide an element by screen size, all the time.
  • Display Conditions. Elementor’s display conditions show or hide an element by rule, such as login status, user role, date or browser. The decision is made when the page loads.

They are the right tools when the site should decide what a visitor sees. We cover them in Elementor display conditions, and the Display Conditions extension page lists every rule it supports. When the visitor should decide, use one of the three click methods above.

Frequently asked questions

How do I show a hidden section when a button is clicked in Elementor?

Give the button the CSS class show-hide-button and the section the class show-hide-target, then add an HTML widget with a short script that toggles a class on the section when the button is clicked. With no code, put the section inside an Accordion item instead.

Can Elementor show or hide a section on click without a plugin?

Yes. The Accordion widget hides whatever is inside an item until its title is clicked, and it is part of Elementor itself. For a custom button, an HTML widget with a few lines of JavaScript does the same job with no extra plugin.

Why does my hidden section also disappear in the Elementor editor?

Your CSS hides it everywhere, including the editor preview. Add a rule that shows it while editing: .elementor-editor-active .show-hide-target { display: flex; }. You can also open the Structure panel and select the hidden container from there.

Is content hidden behind a click bad for SEO?

Not when the content is in the page HTML, which is the case for all three methods here. Search engines can read it. Keep the page’s main content visible by default, and use click-to-show for supporting details.

Can I hide a section until a visitor logs in?

That calls for a condition. Use Display Conditions with a Login Status rule so the section only loads for logged-in visitors. A click-based method would still send the content to everyone’s browser.

Final thoughts

There are three dependable ways to show or hide a section on click in Elementor. Use the Accordion widget when a title bar is fine, a content toggle with one empty option when you want a visible switch, and a button with a short script when the trigger has to sit somewhere else.

If you end up switching between two sections more often than hiding one, the Toggle Content widget is built for that.

Picture of Roy Jemee
Roy Jemee
I'm Roy Jemee, Content Wrangler and Marketer at Pixar Labs, working on Master Addons for Elementor. I write the tutorials, record the videos, and keep the documentation current, so you always know how to use every feature. I also handle support, so if you hit a snag, I'm the person who helps you fix it. Real answers, from someone who uses these tools every day.

Leave a Reply

Your email address will not be published. Required fields are marked *