# Removing input value on btn click

**URL:** <https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975>\
**Category:** General\
**Created:** [30 April 2021 09:34 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975 "2021-04-30T09:34:49Z")\
**Posts on this page:** 6\
**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:** [30 April 2021 09:34 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/1 "2021-04-30T09:34:49Z")

</div>

In my custom node i have a button that adds `<div class="form-row"> <input type="text" /> </div> `  
I would want when i press another button that hides/deletes the form row created to change the input value back to "";  
Because when i type something on input the value of it stays until i delete it

```auto
let myInput = $("#myInput")
btn.on("click",()=> {
myInput.value = ""
}

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 April 2021 09:39 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/2 "2021-04-30T09:39:44Z")

</div>

jQuery [remove](https://api.jquery.com/remove/) - to delete an element

jQuery `.show()` / `.hide()` to show & hide an element

However, why don't you use the node-red built in widget editableList?

---

<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:** [30 April 2021 09:41 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/3 "2021-04-30T09:41:09Z")

</div>

I dont want to remove the element. I already do that in my function. I just want to reset the value to "" everytime i click on the button

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 April 2021 09:42 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/4 "2021-04-30T09:42:07Z")

</div>

[jQuery empty](https://api.jquery.com/empty/)

Or `$("#myInput").val("")`;

---

<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:** [30 April 2021 09:43 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/5 "2021-04-30T09:43:20Z")

</div>

It still stays until i reopen the node. Why doesnt it just change on button click?  
EDIT: you can remove this comment

---

<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:** [14 May 2021 09:43 UTC](https://discourse.nodered.org/t/removing-input-value-on-btn-click/44975/6 "2021-05-14T09:43:24Z")

</div>

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