# Custom Dropdown Node - Problems with deleting options

**URL:** <https://discourse.nodered.org/t/custom-dropdown-node-problems-with-deleting-options/45112>\
**Category:** Developing Nodes\
**Created:** [3 May 2021 13:04 UTC](https://discourse.nodered.org/t/custom-dropdown-node-problems-with-deleting-options/45112 "2021-05-03T13:04:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jake123](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@jake123](https://discourse.nodered.org/u/jake123)\
**Post date:** [3 May 2021 13:04 UTC](https://discourse.nodered.org/t/custom-dropdown-node-problems-with-deleting-options/45112/1 "2021-05-03T13:04:49Z")

</div>

Heelo i have a question. I have a fetch function that that trigers oneditprepare and that gives me dropdown of 3 objects. next to it i have a button which works as "refresh server". Basically on btn click i call the fetch function again .The problem i have is that when i click the button it gives back same 3 objects below other objects. I want when i click on the btn to not have same objects shown

```auto
  for (let i = 0; i < options.length; i++) {
              let value = options[i].v;
              let text = options[i].t;
              $("#node-input-options").append(
                $("<option></option>").attr("value", value).text(text) //For every element in the select tag append appropriate value and text ( <option value="#">#</option> )
              );
            }

```

This fills the dropdown

```auto
  const btnrefreshServer = $(".refreshserverItems");
      btnrefreshServer.on("click", (evn) => {
        let select = document.getElementById("node-input-options");
        let length = select.options.length;
        for (let i = length - 1; i >= 0; i--) {
          select.options[i] = null;
        }
        setTimeout(fetchUrl, 1000);

```

I tried like that but it doesnt work

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 July 2021 13:05 UTC](https://discourse.nodered.org/t/custom-dropdown-node-problems-with-deleting-options/45112/2 "2021-07-02T13:05:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
