How to reset textbox value in JavaScript?

Sometimes, we want to reset textbox value in JavaScript.

In this article, we’ll look at how to reset textbox value in JavaScript.

How to reset textbox value in JavaScript?

To reset textbox value in JavaScript, we set the value property to an empty string.

For instance, we write

document.getElementById("searchField").value = "";

to select the input with getElementById.

Then we set its value property to an empty string.

Conclusion

To reset textbox value in JavaScript, we set the value property to an empty string.