# Code for Show - Hide Function

**URL:** <https://forum.wixstudio.com/t/code-for-show-hide-function/5328>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [September 25, 2018, 12:42am UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328 "2018-09-25T00:42:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lzweifel](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@lzweifel](https://forum.wixstudio.com/u/lzweifel)\
**Post date:** [September 25, 2018, 12:42am UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328/1 "2018-09-25T00:42:37Z")

</div>

Hello all… I am new to WIX and have come across a function I would like to do and struggling to get it to work just right.

I have added 12 buttons and 12 container boxes. Container boxes shall stay hidden until a specific button is clicked. The last button clicked will leave it’s container box until the next button is clicked etc.

So… I managed to figure out how to click button 1 and get container 1 to reveal just as I hoped, however nothing happens when I then click button 2.

Any help would be very much appreciated, cheers!

---

<div class="post-metadata">

**Author:** ![let-s-start-design](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/let-s-start-design/32/686_2.png) [@let-s-start-design](https://forum.wixstudio.com/u/let-s-start-design)\
**Post date:** [September 25, 2018, 1:44am UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328/2 "2018-09-25T01:44:27Z")

</div>

Hi Izweifel, Have you added a on click instruction for each button?  
Can you post the code that you used for the button?

---

<div class="post-metadata">

**Author:** ![\_or](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/_or/32/1004_2.png) [@\_or](https://forum.wixstudio.com/u/_or)\
**Post date:** [September 25, 2018, 11:43am UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328/3 "2018-09-25T11:43:05Z")

</div>

Hi,  
I’d recommend you to check out [this](https://support.wix.com/en/article/working-with-events-in-wix-code) article about wix code’s basics.  
You need to create an onClick event for each button, in the event’s code show the box you want and hide all other boxes(you can do that simply using the API, check it out [here](https://www.wix.com/code/reference/$w.Box.html#show) ).

Good luck 🙂

---

<div class="post-metadata">

**Author:** ![lzweifel](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@lzweifel](https://forum.wixstudio.com/u/lzweifel)\
**Post date:** [September 25, 2018, 2:54pm UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328/4 "2018-09-25T14:54:39Z")

</div>

Hi, thank you I did figure it out in the end. Now just trying to figure out how to stack each box on top of one another!

---

<div class="post-metadata">

**Author:** ![\_or](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/_or/32/1004_2.png) [@\_or](https://forum.wixstudio.com/u/_or)\
**Post date:** [September 26, 2018, 1:07pm UTC](https://forum.wixstudio.com/t/code-for-show-hide-function/5328/5 "2018-09-26T13:07:49Z")

</div>

You can change the arrangement of stacked elements in the settings under “Arrange”.
