How to Set the Elementor Accordion Widget Closed by Default

Elementor comes with an Accordion widget. Along with the Toggle widget, the Accordion widget is great to create sections like FAQ or the similar ones. When working with the Accordion widget, you can add as many items as you want. By default, the first item of the accordion is set to open and Elementor offers no default setting to make it closed. For some users, it is a bit annoying as the main purpose of adding accordion is to hide information and requires user interaction (clicking an accordion item) to display the information.

So, how to set all accordion items closed by default? You can use the following JavaScript to do so.

jQuery(document).ready(function($) {
var delay = 100; setTimeout(function() {
 $('.elementor-tab-content').css('display', 'none'); }, delay);

You can use HTML widget to use the code above. Simply drag the HTML widget and place it right above the Accordion widget. Paste the code to the HTML Code field on the settings panel once the HTML widget is added

That’s it. You can update your page once you are done editing other elements.

If you have multiple accordions on your website and want to make them all closed by default, you can use a custom code instead. To do so, go to Elementor -> Custom Code on your WordPress dashboard. Click the Add new button to add a new custom code.

Give your custom code a name and paste the code. On the Location section, you can choose whether header, footer, or body. Your code will work at any location. Click the Publish button to apply the code.

Try to reload one of the pages on your website that contains an accordion to check the result.

While the Accordion is useful to create an FAQ section, you can only add the text content. Plus, there is no option to add the content from a template. You can only add the content manually using the offered classic editor. If you need to add an image accordion section to your page, you can use Elementor add-ons like JetElements and JetTabs.

This page may contain affiliate links, which help support WP Pagebuilders. Learn more

30 thoughts on “How to Set the Elementor Accordion Widget Closed by Default”

  1. Hi,
    The solution is here:
    You should change “” to ” – End” while creating the code, in select field.
    Then it is working 🙂
    Also “Always load jQuery” – you can leave unchecked.
    PS. This is the only method. A trick with widget does not work.

  2. for all tabs to be closed on the entire page, you can simply implement it in the “functions.php”:

    function jquerytools_scripts() {
    wp_register_script(‘jquerytools’, get_template_directory_uri().’/js/start_closed_tab.js’, array(),”, false);
    add_action( ‘wp_enqueue_scripts’, ‘jquerytools_scripts’ );

    and in “start_closed_tab.js”:

    jQuery(document).ready(function($) {
    var delay = 100; setTimeout(function() {
    $(‘.elementor-tab-content’).css(‘display’, ‘none’);}, delay);

    of course, you can adapt your names…copy “/js/start_closed_tab.js” and update functions.php on the server.

  3. Thanks for this!
    With the Accordion, is it possible to set an item as open by default other than the first item? For example, on a particular page I would like the second Accordion item to be open by default.

  4. Can I do this on only 1 accordion on my page?
    I have a page with 4 separate accordion widgets, and I want to apply this to only 1 of them

  5. For anyone not having luck with the code in this article (like I was), it’s likely because the accordion has not been rendered yet when the code fires. Use the below script instead which doesn’t fire until the page is fully loaded.

    jQuery(window).on(‘load’,function() {
    jQuery(‘.elementor-tab-content’).css(‘display’, ‘none’);


Leave a Comment

Pin It on Pinterest

Thanks for commenting

Help us grow by sharing this post with your friends!

10+ free Elementor landing page templates. No extra plugin!

Creating with WordPress?​

Subscribe and join 1,500+ WordPress users receiving tips and insights on creating with WordPress in the no-code era. At WP Pagebuilders, we write about the following topics a lot.