Categories
JavaScript Answers

How to put a clear button inside a HTML text input box?

Spread the love

Sometimes, we want to put a clear button inside a HTML text input box.

In this article, we’ll look at how to put a clear button inside a HTML text input box.

How to put a clear button inside a HTML text input box?

To put a clear button inside a HTML text input box, we add an input with type attribute set to search.

For instance, we write

<input type="search" placeholder="Search..." />

to add the input with type set to search to make the clear button show on the right end of the input box.

Conclusion

To put a clear button inside a HTML text input box, we add an input with type attribute set to search.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *