How to Close the Accordion in Elementor by Default?

Table of Contents

Want to get professional advice?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Table of Contents

Elementor has become the most popular page builder plugin in the WordPress community, and we frequently use it in our company’s client projects.

In today’s post, I’m sharing a small trick that will help you give a unique look to Elementor accordions.

Make Accordions Closed by Default

It’s very common for a client to ask you โ€œto putโ€ information on accordions. It’s often used for SEO purposes.

The page needs to have a certain number of words, but there’s no way that so much text will fit.

The problem is that by default, in Elementor, the first tab in the accordion is always open.

And some clients hate that!

Is there a solution? Of course, you just paste the following code in the HTML area anywhere you want on the page:

<script> 
jQuery(document).ready(function($) { 
var delay = 100; setTimeout(function() { 
  $('.elementor-tab-title').removeClass('elementor-active');
  $('.elementor-tab-content').css('display', 'none'); }, delay); 
}); 
</script>

And voila! It closes by default. Nothing else to do. Easy, useful, quick, and for the whole family. We hope this serves you well!

Additional Method via Functions File

Go to the functions.php file and add the following code:

function elementor_accordion_title() { ?>
<script>
jQuery(document).ready(function() {
  jQuery( โ€˜.elementor-accordion .elementor-tab-titleโ€™ ).removeClass( โ€˜elementor-activeโ€™ );
  jQuery( โ€˜.elementor-accordion .elementor-tab-contentโ€™ ).css( โ€˜displayโ€™, โ€˜noneโ€™ );
});
</script>
<?php }
add_action( โ€˜wp_footerโ€™, โ€˜elementor_accordion_titleโ€™, 99 );

About the author

Ben Kalsky, Founder & Partner at Digitizer

Ben has 13+ years of experience building websites for technology companies, e-commerce businesses, and service providers across Israel and internationally. As co-founder of Digitizer, he’s delivered over 100 projects ranging from โ‚ช5,000 landing pages to โ‚ช100,000+ enterprise platforms.

Notable work includes:

  • Building platforms for companies later acquired by Fortune 500 firms (CrowdStrike, Nvidia)
  • Migrating 50+ businesses from proprietary platforms to WordPress, saving an average of โ‚ช80,000/year in platform fees
  • Managing infrastructure for 100+ websites with 99.9% uptime over 3 years

Ben specializes in WordPress, WooCommerce, automation, and helping businesses make smart technology decisions that scale. His approach: practical, process-based solutions that drive measurable business growth – no buzzwords, no vendor lock-in.

On Digitizer’s blog, he shares real-world insights on website pricing, platform selection, and avoiding costly mistakes when building digital infrastructure.

Connect on LinkedIn | Free Consultation | More Articles

Share the article

Copy

More articles