How To Clear Form Fields With JQuery

For More Videos Visit Our YouTube Channel




Here we consider how to Clear Form Fields by using JQuery. Lets start with one example here. Suppose there is are some textboxes including password and multiline textarea as shown below.

Clear Form Fields Using JQuery, How To Clear Form Fields Using JQuery, Clear Form Fields With JQuery, How To Clear Form Fields With JQuery, Jquery Clear Form Fields, Clear textbox Using JQuery, Clear Input Type Text Using JQuery, Clear Textarea Using JQuery, Clear Input Password Using JQuery, Jquery, HTML

Clear Form Fields Using JQuery, How To Clear Form Fields Using JQuery, Clear Form Fields With JQuery, How To Clear Form Fields With JQuery, Jquery Clear Form Fields, Clear textbox Using JQuery, Clear Input Type Text Using JQuery, Clear Textarea Using JQuery, Clear Input Password Using JQuery, Jquery, HTML

Now for clearing these form fields on Button Click using Jquery, follow these code.

$(function () {
          $('.clsClearBtn').click(function () {
                   var form = $(this).closest('form');
                   form.find("input[type=text], input[type=password], textarea").val("");
                   return false;
          })
})



Here we first find the form and then set input fields value to empty. Thereby we can clear all textboxes including password and multiline textarea using Jquery.