# SOLVED Show or hide element in dynamic page depending on boolean

**URL:** <https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [April 22, 2020, 2:19pm UTC](https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204 "2020-04-22T14:19:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![join993](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@join993](https://forum.wixstudio.com/u/join993)\
**Post date:** [April 22, 2020, 2:19pm UTC](https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204/1 "2020-04-22T14:19:49Z")

</div>

I’ll apologize straight away because I’m totally new at this, but I’ve been googling this for hours now and I can’t solve it.

I have a dynamic page and on these pages I would like to hide, or show, an element(just a small icon/vector art) depending on the boolean value in the database. If true show, if false hide.

```javascript
import wixData from 'wix-data';

$w.onReady(function () { 
$w("#dynamicDataset").onReady(() => { 
let items = $w("#dynamicDataset").getCurrentItem(); 
if (items["test"]) { $w("#testtext").show(); }
else $w("#testtext").hide();
}); 

```

“test” is the name of the field(boolean field) in the database. “testtext” is the ID of the element on the page.

That’s what I currently have and it’s obviously placeholders but I’m really tearing my hair trying to figure it out. I’ve looked through probably all the forums posts related to this and read documentation upon documentation, but it seems I’m currently too dumb to solve it myself.

---

<div class="post-metadata">

**Author:** ![join993](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@join993](https://forum.wixstudio.com/u/join993)\
**Post date:** [April 23, 2020, 9:12am UTC](https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204/2 "2020-04-23T09:12:38Z")

</div>

I solved it using this tutorial [https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play](https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play)

Code I used is below if anyone else is similarly new as I am.

```javascript
$w.onReady(() => {
    $w("#dynamicDataset").onReady(() => {
 const item = $w("#dynamicDataset").getCurrentItem();
 if (!item.test) {
            $w("#testtext").hide();
        }
    });
});

```

---

<div class="post-metadata">

**Author:** ![rhafikishantaram](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rhafikishantaram/32/29556_2.png) [@rhafikishantaram](https://forum.wixstudio.com/u/rhafikishantaram)\
**Post date:** [August 27, 2021, 3:42am UTC](https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204/3 "2021-08-27T03:42:17Z")

</div>

greatly appreciated

---

<div class="post-metadata">

**Author:** ![marchajass](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/marchajass/32/10542_2.png) [@marchajass](https://forum.wixstudio.com/u/marchajass)\
**Post date:** [January 1, 2022, 3:42pm UTC](https://forum.wixstudio.com/t/solved-show-or-hide-element-in-dynamic-page-depending-on-boolean/25204/4 "2022-01-01T15:42:20Z")

</div>

```javascript
Thank you very much, I have been looking for the solution for a long time.

```
