# Dynamic Pages adding element only on one item

**URL:** <https://forum.wixstudio.com/t/dynamic-pages-adding-element-only-on-one-item/71266>\
**Category:** Ask the community\
**Tags:** question\
**Created:** [June 1, 2025, 8:36pm UTC](https://forum.wixstudio.com/t/dynamic-pages-adding-element-only-on-one-item/71266 "2025-06-01T20:36:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonia\_Mardones](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/antonia_mardones/32/108293_2.png) [@Antonia\_Mardones](https://forum.wixstudio.com/u/Antonia_Mardones)\
**Post date:** [June 1, 2025, 8:36pm UTC](https://forum.wixstudio.com/t/dynamic-pages-adding-element-only-on-one-item/71266/1 "2025-06-01T20:36:56Z")

</div>

How can I add an element to a dynamic page so that it only appears on one specific item, and not on all dynamic pages?

---

<div class="post-metadata">

**Author:** ![Dan\_Suhr](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/dan_suhr/32/94074_2.png) [@Dan\_Suhr](https://forum.wixstudio.com/u/Dan_Suhr)\
**Post date:** [June 1, 2025, 10:04pm UTC](https://forum.wixstudio.com/t/dynamic-pages-adding-element-only-on-one-item/71266/2 "2025-06-01T22:04:20Z")

</div>

You need to code it. So if the field in the CMS is blank it will not display

```javascript
const currentItem = $w('#yourDatasetID').getCurrentItem();

$w.onReady(function () {
     if (!currentItem.databaseFeildID) { $w("#itemToHideID").collapse(); }
});

```

---

<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:** [June 2, 2025, 10:23am UTC](https://forum.wixstudio.com/t/dynamic-pages-adding-element-only-on-one-item/71266/3 "2025-06-02T10:23:44Z")

</div>

Exactly as @Dan_Suhr mentioned 👆

* * *

Only thing I’d add is wrapping it with an `onReady` for the dataset too (make sure it’s ready before getting the currentItem).

```javascript
$w.onReady(function () {
    $w('#yourDatasetID').onReady(() => {
        const currentItem = $w('#yourDatasetID').getCurrentItem();

        if (currentItem.databaseFieldID) {
            $w("#itemToHideID").expand();
        }

    })
});

```

And (personally), I’d make the element collapsed by default in the code properties panel, and then “if the collection has the item, expand the element”
