# hide and show inputs depending of the dropdown selection

**URL:** <https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [September 18, 2020, 7:19pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819 "2020-09-18T19:19:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravand0010](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ravand0010/32/23534_2.png) [@ravand0010](https://forum.wixstudio.com/u/ravand0010)\
**Post date:** [September 18, 2020, 7:19pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/1 "2020-09-18T19:19:02Z")

</div>

i have a dropdown i want to show an input or hide it depending of the selection of dropdown please help me with full code

---

<div class="post-metadata">

**Author:** ![arthurvalatin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/arthurvalatin/32/19996_2.png) [@arthurvalatin](https://forum.wixstudio.com/u/arthurvalatin)\
**Post date:** [September 20, 2020, 4:02pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/2 "2020-09-20T16:02:48Z")

</div>

Hi Ravand,

Here is a site that I created that has the functionality you are wanting: [https://muniturbusiness.wixsite.com/mysite-19](https://muniturbusiness.wixsite.com/mysite-19)  
If user selects any other category than “Legal” in the dropdown, they will see formA. If user selects “Legal”, they will see formB.

I can’t give you the full code you need but I can give you a starter. You should be able to adopt it to fit your needs.

```javascript
import wixData from 'wix-data';
export function myDropDown_change(event) {
 
 if($w("#myDropDown").value === 'Legal') { //replace 'legal'
        $w("#myInput").show();
      } else {
        $w("#myInput").hide();  
      }
}
 

```

---

<div class="post-metadata">

**Author:** ![ravand0010](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ravand0010/32/23534_2.png) [@ravand0010](https://forum.wixstudio.com/u/ravand0010)\
**Post date:** [September 21, 2020, 12:14pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/3 "2020-09-21T12:14:20Z")

</div>

thanks for you bro i did it

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [October 1, 2020, 1:42pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/4 "2020-10-01T13:42:11Z")

</div>

I have same question.

my code is:

```javascript
import wixData from 'wix-data';
export function myDropDown_change(event) {
 
 if($w("#dropdown1").value === '紹介') { //replace 'legal'
        $w("#input1").show();
      } else {
        $w("#input1").hide();  
      }
}

```

It’s not working.  
it’s in the lightbox, is there anything else I need to do?

---

<div class="post-metadata">

**Author:** ![ravand0010](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ravand0010/32/23534_2.png) [@ravand0010](https://forum.wixstudio.com/u/ravand0010)\
**Post date:** [October 1, 2020, 1:48pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/5 "2020-10-01T13:48:44Z")

</div>

yes change this name(myDropDown) on your code to (dropdown1) it will work because u should write the same name in both places

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [October 1, 2020, 2:26pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/6 "2020-10-01T14:26:12Z")

</div>

I already try it. but not working.

```javascript
import wixData from 'wix-data';
export function dropdown1_change(event) {
 
 if($w("#dropdown1").value === '紹介') { //replace 'legal'
        $w("#input1").show();
      } else {
        $w("#input1").hide();  
      }
}

```

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [October 1, 2020, 2:33pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/7 "2020-10-01T14:33:30Z")

</div>

The spelling is also correct.

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/0/701357c1870824c524c387aa54edebfe9ac4cb3f.jpeg)

 ![](https://us1.discourse-cdn.com/wix/original/3X/6/0/60a50c4f351fc5f98014d010b5becfbbe371fede.jpeg)

 ![](https://us1.discourse-cdn.com/wix/original/3X/e/c/ece3dedf10fac927dab00d695b8c035aaa80a943.jpeg)

---

<div class="post-metadata">

**Author:** ![ravand0010](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ravand0010/32/23534_2.png) [@ravand0010](https://forum.wixstudio.com/u/ravand0010)\
**Post date:** [October 1, 2020, 4:06pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/8 "2020-10-01T16:06:19Z")

</div>

@nanami you have to do another step remove all ur code select the dropdown and click the onChange tab in the right then click on the page code it will automatically write this code (export function dropdown1\_change(event) {} ) then type the code you want on the brackets {}

 ![](https://us1.discourse-cdn.com/wix/original/3X/1/d/1dd2c112be70aec1913000b200d5fd350c173e7a.jpeg)

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [October 2, 2020, 7:23am UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/9 "2020-10-02T07:23:29Z")

</div>

@ravand0010  
Thank you so much!!!  
It’s solved!!!  
I forgot to check there…

you are great!!!

---

<div class="post-metadata">

**Author:** ![ravand0010](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ravand0010/32/23534_2.png) [@ravand0010](https://forum.wixstudio.com/u/ravand0010)\
**Post date:** [October 4, 2020, 4:31pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/10 "2020-10-04T16:31:07Z")

</div>

@nanami you are welcome bro💚

---

<div class="post-metadata">

**Author:** ![mahvishhasan05](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mahvishhasan05/32/36240_2.png) [@mahvishhasan05](https://forum.wixstudio.com/u/mahvishhasan05)\
**Post date:** [January 19, 2023, 6:02pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/11 "2023-01-19T18:02:31Z")

</div>

how did you solve it?

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [January 20, 2023, 4:38pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/12 "2023-01-20T16:38:07Z")

</div>

Sorry this was so long time ago.  
So i forgot…

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [January 22, 2023, 8:44pm UTC](https://forum.wixstudio.com/t/hide-and-show-inputs-depending-of-the-dropdown-selection/35819/13 "2023-01-22T20:44:05Z")

</div>

Please open your own post with your own in detail described issue.  
And someone will surely take a look onto your problem.
