Reset all Fields using jQuery






4.93/5 (7 votes)
This is an alternative for "Reset all Fields using jQuery"
Introduction
Reseting the form to it’s initial values is one of those things you do often.
Doing this task with jQuery is really easy:<form id="FormID" name= "FormID" action="#" method="get">
your input controls here
</form>
//Using single line you can clear all the inputs from the form.
$("#mybutton").click(function(){
$('#FormID').each (function(){
this.reset();
});
});
//OR you may using this code
//reset form
$("#mybutton").click(function(){
$("#FormID").find('input:text, input:password, input:file, select, textarea').val('');
$("#FormID").find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
});