jQuery

jQuery Empty Input Textbox | Textarea

Did you want to clear the existing value of a form input i.e. clear Texbox and/or Textarea values using jQuery? It is very simple to do so. You can do it using just 1 line of code. Follow along.

How to Empty Input Textbox, Textarea using jQuery

Le’ts assume that you an input Textbox with ID “city” and a Textarea with ID “comments”.

Example: Empty Textbox using jQuery

$('#city').val('');

Example: Empty Textarea using jQuery

$('#comments').val('');
Very simple, isn’t it?

Do you know of any other ways to empty input textbox / textarea using jQuery? Feel free to suggest by commenting below.

Share your thoughts, comment below now!

*

*