faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

78 of 116 people (67%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I clear a form?
How do I reset a FORM?

Mar 10th, 2000 09:31
Martin Honnen, BJ Neyer,


FORM objects have a 
  reset
method you can call to reset/clear a form. It has the same effect like 
an
 <INPUT TYPE="reset">
button meaning it restores the initial values of all form elements.
So call
  document.formName.reset();
or
  document.forms[formIndex].reset();
or
  document['formName'].reset();
depending on how your reference your form. See also
http://www.faqts.com/knowledge-base/view.phtml/aid/1544/fid/129/lang/
on how to reset all forms in a document.