Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Reset all Fields using jQuery

, 21 May 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
This is an alternative for "Reset all Fields using jQuery"


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

//Using single line you can clear all the inputs from the form.
   $('#FormID').each (function(){
//OR you may using this code
//reset form 
    $("#FormID").find('input:text, input:password, input:file, select, textarea').val('');
    $("#FormID").find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sunasara Imdadhusen
Software Developer (Senior) Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen
  1. 1st Best Asp.Net article of SEP 2010
  2. 2nd Best Asp.Net article of MAY 2011
Read More Articles...
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

GeneralMy vote of 5 PinmemberHumayun Kabir Mamun21-May-14 19:16 
GeneralRe: My vote of 5 PinprofessionalSunasara Imdadhusen21-May-14 19:20 
SuggestionNice effort ! PinprofessionalJagbir Saini21-May-14 5:16 
GeneralRe: Nice effort ! PinprofessionalSunasara Imdadhusen21-May-14 19:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 21 May 2014
Article Copyright 2014 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid