# Tabbed Content Module Duplicating content in Other Tabs

**URL:** <https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682>\
**Category:** CMS Development\
**Created:** [April 4, 2023, 2:18pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682 "2023-04-04T14:18:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![JWatson04](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@JWatson04](https://community.hubspot.com/u/JWatson04)\
**Post date:** [April 4, 2023, 2:18pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/1 "2023-04-04T14:18:10Z")

</div>

Hello,

I’m fairly new to creating modules in HubL and I’ve been trying to create a tabbed card module with a 2 column layout for a bit now. I duplicated the module from an existing tabbed module in Hubspot, and for the most part, it works.

The main problem I’m having now is that the content from every other tab is being duplicated in each tab. How would I make it so only the desired content is in its respective tab?

This is my code along with a screenshot the fields I’ve created:

```lia-code-sample
 {# Tab content #}
 {% set hidden_class = "" %}
 <div class="hs-tabs__content">
 {% for tab in module.tabs %}
 {% set hidden_class = "hs-tabs __content__ panel--visible" if loop.first %}
 <div
 class="hs-tabs __content__ panel {{ hidden_class }}"
 tabindex="0"
 role="tabpanel"
 id="hs-tabs __content__ panel-{{ loop.index }}--{{ name }}"
 aria-labelledby="hs-tabs__tab-{{ loop.index }}--{{ name }}"
 >
 {% for item in module.tabs %}
 <div class="tabs_inside_container">
 {% for item2 in item.tab_group_1 %}

 <div class="row">
 <div class="tabs_column">
 <div class="tabs_video_container">
 {% if item2.tab_video.player_id %}
 {% set max_width = item2.tab_video.size_type == 'auto_custom_max' ? item2.tab_video.max_width : item2.tab_video.width %}
 {% set max_height = item2.tab_video.size_type == 'auto_custom_max' ? item2.tab_video.max_height : item2.tab_video.height %}
 {% video_player "embed_player"
 player_id={{ item2.tab_video.player_id }}
 type={{ item2.tab_video.player_type || 'scriptV4' }}
 full_width={{ item2.tab_video.size_type == 'auto_full_width' }},
 conversion_asset={{ item2.tab_video.conversion_asset|tojson|safe }}
 autoplay={{ item2.tab_video.autoplay }}
 hidden_controls={{ item2.tab_video.hide_controls }}
 loop={{ item2.tab_video.loop_video }}
 muted={{ item2.tab_video.mute_by_default }}
 %}
 {% endif %}
 </div> 
 </div>
 <div class="tabs_column">
 <div class="tabs_inside_content">
 <h2>{% inline_text field="tab_headline" value="{{ item2.tab_headline }}" %}</h2>
 {% inline_rich_text field="content" value="{{ item2.content }}" %}
 </div>
 </div>
 </div>

 {% endfor %}
 </div>
 {% endfor %}
 </div>

 {% endfor %}
 </div>

```

Below are the example and the fields I have currently in place.

 ![tabbed_content_screenshot.PNG.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/e/4e70ac23b7b08326258a9a9a8e710b489738fe68.jpeg)

 ![tabs_backend_screenshot.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/5/257f146734b2b11772d0fc429d011e68a462cd37.png)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [April 5, 2023, 6:58pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/2 "2023-04-05T18:58:28Z")

</div>

Hey, @JWatson04 👋 Thank you for reaching out. Let’s invite some of our community members to the conversation — hey @BarryGrennan @Jnix284 @Kevin-C, can you offer @JWatson04 any tips? Or suggestions on other ways they can tackle this project?

Thank you very much! — Jaycee

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [April 6, 2023, 3:33pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/3 "2023-04-06T15:33:33Z")

</div>

Happy to help point you in the right direction @JWatson04 , check out [this example showing how to convert tabs to an accordion on mobile](https://designers.hubspot.com/code-gallery/entry/founders/esparkbizhubspot-tabs-to-accordion-module), I think it will help to see a working example so you can try to solve the issue 🙂

---

<div class="post-metadata">

**Author:** ![JWatson04](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@JWatson04](https://community.hubspot.com/u/JWatson04)\
**Post date:** [April 6, 2023, 6:19pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/4 "2023-04-06T18:19:13Z")

</div>

Thank you so much for sending that over, it helped me move this project along!

It looks like now the only problem I’m having is that the content from other tabs is being pulled in across all other tabs.  
Are there any solutions to prevent the same content from being duplicated in all of the tabs?

 ![tabbed_content.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/7/475145af05a949073432fc70bb920fc6f18f1eb5.png)

This is my code now:

```lia-code-sample
<div class="tabs-container">
 <div class="tabs-btn-container">
 {% for item in module.tabbed_card_group %}
 <button {% if loop.index == 1 %}class="tab-button active"{% endif %} data-id="{{loop.index}}">{{ item.tab_title }}</button>
 {% endfor %}
 </div>
 {% for item in module.tabbed_card_group %}
	{% inline_text field="tab_title" value="{{ item.tab_title }}" %}
 {% endfor %}
 <div class="tabs-content-container">
	{% for item2 in item.field_group %}
 <div class="tabs-inside-content active" id="{{loop.index}}">
 <div class="row">
 {% if loop.index %}
 <div class="tabs-column">
 <div class="tabs-video-container">
		{% if item2.tab_video.player_id %}
		 {% set max_width = item2.tab_video.size_type == 'auto_custom_max' ? item2.tab_video.max_width : item2.tab_video.width %}
		 {% set max_height = item2.tab_video.size_type == 'auto_custom_max' ? item2.tab_video.max_height : item2.tab_video.height %}
		 {% video_player "embed_player"
		 player_id={{ item2.tab_video.player_id }}
		 type={{ item2.tab_video.player_type || 'scriptV4' }}
		 full_width={{ item2.tab_video.size_type == 'auto_full_width' }},
		 conversion_asset={{ item2.tab_video.conversion_asset|tojson|safe }}
		 autoplay={{ item2.tab_video.autoplay }}
		 hidden_controls={{ item2.tab_video.hide_controls }}
		 loop={{ item2.tab_video.loop_video }}
		 muted={{ item2.tab_video.mute_by_default }}
		 %}
		{% endif %}
 </div>
 </div>
 <div class="tabs-column">
 <div class="tabs-content">

 {% inline_text field="tab_content_headline" value="{{ item2.tab_content_headline }}" %}
 {% inline_rich_text field="tab_content" value="{{ item2.tab_content }}" %}

 </div>
 </div>
 {% endif %}
 </div>
 </div>
{% endfor %}
 </div>

</div>

```

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [April 6, 2023, 6:29pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/5 "2023-04-06T18:29:17Z")

</div>

@JWatson04 you’re welcome!

I’m pretty sure the duplicated tab content is going to be caused by your JS, not the module code.

Are you using the module JS or referencing an external JS for the theme that you’re building the module for?

---

<div class="post-metadata">

**Author:** ![JWatson04](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@JWatson04](https://community.hubspot.com/u/JWatson04)\
**Post date:** [April 6, 2023, 7:00pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/6 "2023-04-06T19:00:39Z")

</div>

I was using the JS that was from the example that was sent over and I was getting an “ **Uncaught ReferenceError: $ is not defined** ”. I think jQuery needs to be converted to JS, but I’m not experienced enough to convert jQuery to JS.

This is what outputs to the page when I use the JS from the example code:

 ![tabbed_content-2.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/9/89bce151ca640e0fefa10bfddf47a790c1a264f7.png)

 ![tabbed_content-js.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/b/bb3844baa85c4a37ba1ed10c4505833d411d7ad2.png)

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [April 6, 2023, 7:51pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/7 "2023-04-06T19:51:22Z")

</div>

@JWatson04 yes, unfortunately converting jQuery to JS is not my area of expertise either 😞

Maybe one of the others will still be able to help!

---

<div class="post-metadata">

**Author:** ![JWatson04](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@JWatson04](https://community.hubspot.com/u/JWatson04)\
**Post date:** [April 6, 2023, 8:56pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/8 "2023-04-06T20:56:14Z")

</div>

That’s all right @Jnix284 , thank you for your help anyway!

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [April 14, 2023, 1:47pm UTC](https://community.hubspot.com/t/tabbed-content-module-duplicating-content-in-other-tabs/78682/9 "2023-04-14T13:47:14Z")

</div>

Hey @JWatson04 is there anyway you could ZIP and send the module code or get it up on GitHub? That would make it much easier to collaborate. Im sure we can find a solution that works for you rather quickly!
