# Show or hide selected buttons in the repeater

**URL:** <https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833>\
**Category:** Ask the community\
**Tags:** question\
**Created:** [September 26, 2025, 11:45am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833 "2025-09-26T11:45:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user6216](https://avatars.discourse-cdn.com/v4/letter/u/bcef8e/32.png) [@user6216](https://forum.wixstudio.com/u/user6216)\
**Post date:** [September 26, 2025, 11:45am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/1 "2025-09-26T11:45:37Z")

</div>

I’m trying to hide specific buttons in a repeater based on certain conditions, but I’m running into issues. Could anyone guide me through the correct approach?

---

<div class="post-metadata">

**Author:** ![noahlovell](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/noahlovell/32/118920_2.png) [@noahlovell](https://forum.wixstudio.com/u/noahlovell)\
**Post date:** [September 26, 2025, 3:25pm UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/2 "2025-09-26T15:25:08Z")

</div>

I imagine you want different buttons showing per item?

If so, it’s going to require some code. Are you able to share a little more about your setup, what you want to show when and code you’ might have already tried?

---

<div class="post-metadata">

**Author:** ![Rob](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rob/32/84134_2.png) [@Rob](https://forum.wixstudio.com/u/Rob)\
**Post date:** [September 26, 2025, 4:49pm UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/3 "2025-09-26T16:49:26Z")

</div>

I did [a video](https://www.youtube.com/watch?v=DtYVGUR0juw&lc=UgzaWraVXsfciAiudSR4AaABAg) a while back using the CMS on adding conditional visibility and while mines works within a dynamic page, it’s a similar concept within a repeater.

I tried something like in my video with a repeater and the main difference is to adjust it to work within each repeater item.

```javascript
$w.onReady(function () {
    // Set up the onItemReady handler for the repeater
    $w('#repeater1').onItemReady(($item, itemData, index) => {
        // Collapse #imageX2 if 'mainMedia' field is empty or not present
        if (!itemData.swatchImage) {
            $item('#imageX1').collapse();
        } else {
            $item('#imageX1').expand();
        }

        // Collapse #text10 if 'colorName' field is empty or not present
        if (!itemData.colorName) {
            $item('#text10').collapse();
        } else {
            $item('#text10').expand();
        }

        // Collapse #text11 if 'rgbValue' field is empty or not present
        if (!itemData.rgbValue) {
            $item('#text11').collapse();
        } else {
            $item('#text11').expand();
        }

        // Collapse #text23 if 'hotCold' field is empty or not present
        if (!itemData.hotCold) {
            $item('#text23').collapse();
        } else {
            $item('#text23').expand();
        }
    });
});

```

Here’s how you can see some of the items are not collapsed since the CMS is empty. [https://robertor0.wixstudio.com/my-site-53#comp-m9lqn0m2](https://robertor0.wixstudio.com/my-site-53#comp-m9lqn0m2)

---

<div class="post-metadata">

**Author:** ![user6216](https://avatars.discourse-cdn.com/v4/letter/u/bcef8e/32.png) [@user6216](https://forum.wixstudio.com/u/user6216)\
**Post date:** [September 30, 2025, 2:04am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/4 "2025-09-30T02:04:45Z")

</div>

Hi, good day,

My colleague and I created a page for our team’s publications, and we’d like different buttons (with names) to show per item. Currently, we’re using a repeater connected to a dataset.

What we’d like is for a button to display only when a name tag exists for that item, and to be hidden when it doesn’t.

I haven’t tried much code yet, so I’d appreciate any guidance on how to set this up.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![user6216](https://avatars.discourse-cdn.com/v4/letter/u/bcef8e/32.png) [@user6216](https://forum.wixstudio.com/u/user6216)\
**Post date:** [September 30, 2025, 2:18am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/5 "2025-09-30T02:18:36Z")

</div>

HI Rob, we will try and see how it goes. Thank you

---

<div class="post-metadata">

**Author:** ![Rob](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rob/32/84134_2.png) [@Rob](https://forum.wixstudio.com/u/Rob)\
**Post date:** [September 30, 2025, 11:27am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/6 "2025-09-30T11:27:55Z")

</div>

Hope it helps. Definitely check the IDs of elements. In my example, the text isn’t semantic but the CMS fields are. I find it works best when starting off to name things closely so it can be easily read and worked with ([and really should always be done but I tend to forget when making examples and tutorials for others](https://dev.wix.com/docs/velo/articles/getting-started/working-with-page-elements#element-selection)).

This should help you get started if you haven’t coded much before. [Getting Oriented](https://dev.wix.com/docs/velo/articles/getting-started/getting-oriented)

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [October 30, 2025, 11:28am UTC](https://forum.wixstudio.com/t/show-or-hide-selected-buttons-in-the-repeater/73833/7 "2025-10-30T11:28:52Z")

</div>

Closed on October 30, 2025, 11:28am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
