# Reset Dropdown selection

**URL:** <https://forum.wixstudio.com/t/reset-dropdown-selection/32245>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [October 6, 2017, 3:30pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245 "2017-10-06T15:30:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![duda-aleo](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/duda-aleo/32/881_2.png) [@duda-aleo](https://forum.wixstudio.com/u/duda-aleo)\
**Post date:** [October 6, 2017, 3:30pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/1 "2017-10-06T15:30:11Z")

</div>

How can i reset the dropdown selections?

can i clear the dropdowns items?

---

<div class="post-metadata">

**Author:** ![giedrius-grazevicius](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/giedrius-grazevicius/32/711_2.png) [@giedrius-grazevicius](https://forum.wixstudio.com/u/giedrius-grazevicius)\
**Post date:** [October 6, 2017, 3:42pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/2 "2017-10-06T15:42:01Z")

</div>

Hi,

you can set dropdown selections by setting _options_ property on a dropdown. You can also clear the options by setting it an an empty array.

You can find full API here:

> **[Dropdown - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/$w/dropdown)**
>
> Dropdowns are used for selecting one of a number of options.

---

<div class="post-metadata">

**Author:** ![thrishtilabs](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/thrishtilabs/32/950_2.png) [@thrishtilabs](https://forum.wixstudio.com/u/thrishtilabs)\
**Post date:** [March 25, 2018, 12:31pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/3 "2018-03-25T12:31:22Z")

</div>

Hi Giedrius,  
I want to reset the drop down placeholder to default value when a button is clicked. I used code as shown here.

```javascript

export function sortbutton_click(event) {
	$w("#stateselectbutton").placeholder = "Select State:";
	$w("#adtypeselectbutton").placeholder = "Select Type:";
      $w("#typeselectbutton").placeholder = "Select Category:";
	}

```

But unfortunately its not resting the place holder. Am I doing anything wrong?

---

<div class="post-metadata">

**Author:** ![benjaminchanyanjun](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/benjaminchanyanjun/32/3755_2.png) [@benjaminchanyanjun](https://forum.wixstudio.com/u/benjaminchanyanjun)\
**Post date:** [August 8, 2018, 4:55pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/4 "2018-08-08T16:55:29Z")

</div>

Hi Nithin,

You can reset the value of the dropdown elements to the placeholder text.

```javascript
export function sortbutton_click(event) { 
$w("#stateselectbutton").value = "Select State:"; 
$w("#adtypeselectbutton").value = "Select Type:"; 
$w("#typeselectbutton").value = "Select Category:"; }

```

You can refer to this website on how to reset dropdown elements.  
[https://www.vorbly.com/Vorbly-Code/WIX-CODE-RESET-FORM-WITH-BUTTON](https://www.vorbly.com/Vorbly-Code/WIX-CODE-RESET-FORM-WITH-BUTTON)

Good luck!

Cheers,  
Ben

---

<div class="post-metadata">

**Author:** ![doron-alkalay](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/doron-alkalay/32/2887_2.png) [@doron-alkalay](https://forum.wixstudio.com/u/doron-alkalay)\
**Post date:** [August 9, 2018, 4:59pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/5 "2018-08-09T16:59:24Z")

</div>

Hi guys!

Note that the two methods are different with different purposes.  
The “.placeholder” method changes the default writing in the input field, you can even say it changes the title of the field.  
The “.value” method changes the value of the user’s input. Lets say that I have an input field for a phone number. The ‘placeholder’ is - Phone Number;  
While the value will be my input would be: +123 45 - 6789 - 012.

Other than that, #Nithin, your code seems fine.  
Make sure that you use the correct selector name (aka Component ID; aka $w(‘#yourComponent’) ) and that the event of ‘sortbutton\_click’ exists in the button’s properties.

Hope it helps!

Doron.

---

<div class="post-metadata">

**Author:** ![jeff-haskins](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jeff-haskins/32/1864_2.png) [@jeff-haskins](https://forum.wixstudio.com/u/jeff-haskins)\
**Post date:** [February 15, 2019, 2:56am UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/6 "2019-02-15T02:56:30Z")

</div>

@doron-alkalay Issues I have found with clear buttons

> **[Reset / Clear Search Bar button for repeater menu (coded search box and two...](https://community.wix.com/velo/forum/coding-with-velo/reset-clear-search-bar-button-for-repeater-menu-coded-search-box-and-two-drop-downs)**
>
> I also have coded in save search so if they leave and come back the prior search is saved, but with multiple drop downs I could see it nice for a reset for the entire search.
> 
> There is this for clearing drop downs (you can add line for each drop down...

---

<div class="post-metadata">

**Author:** ![bholy513](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@bholy513](https://forum.wixstudio.com/u/bholy513)\
**Post date:** [October 26, 2021, 11:08pm UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/7 "2021-10-26T23:08:28Z")

</div>

I was finally able to make this work. I have 5 dropdowns that all pull their information from one dataset. I added a button and used the below code to return all values to the placeholder text, which on my page is “Select”. It took me a long time to figure this out as I am a first time coder. Several of the examples I tried just would not work. Be sure to set the button properties to “onClick()”

export function button3\_click ( event , $w ) {  
// This function was added from the Properties & Events panel.  
// Add your code for this event here:  
$w ( “#dropdown1” ). selectedIndex = **null** ;  
$w ( “#dropdown2” ). selectedIndex = **null**  
$w ( “#dropdown3” ). selectedIndex = **null** ;  
$w ( “#dropdown4” ). selectedIndex = **null** ;  
$w ( “#dropdown5” ). selectedIndex = **null** ;  
}

 ![](https://us1.discourse-cdn.com/wix/original/3X/e/b/eb82101d64d712efc827f553a2398aa7b019985f.png)

---

<div class="post-metadata">

**Author:** ![onlinesanawad](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onlinesanawad/32/28941_2.png) [@onlinesanawad](https://forum.wixstudio.com/u/onlinesanawad)\
**Post date:** [June 26, 2022, 9:30am UTC](https://forum.wixstudio.com/t/reset-dropdown-selection/32245/8 "2022-06-26T09:30:28Z")

</div>

Amazing solution… 🎯 … You saved my life buddy. A truck full of thanks.
