Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset values in Java Script

Status
Not open for further replies.

deekap

MIS
Dec 17, 2003
10
US
I don't much about Java Script
Can anyone tell me how to reset values in Java Script.
I have a form and i select 1 value from select tag and it displays information in other fields on the basis of the value selected from that tag. but i want to reset values in those textfields.
<input type=&quot;Reset&quot; name=&quot;Reset&quot; value =&quot;Reset&quot;>
this tag won't work, i have to use Java Script.
plz help.

 
deekap,

Try something like this:

Code:
<INPUT TYPE=&quot;button&quot; VALUE=&quot;Reset Form&quot; onClick=&quot;document.forms['myFormName'].reset();&quot;>

Where you would substitute myFormName for the name of your form...

Hope this helps!

Dan
 
Sorry, I should have mentioned...

Calling form.reset() resets all fields within that form to their default values, which are not necessarily blank/empty.

Whatever values you set for each field when the form is first loaded will be what they revert back to when the reset() method is called.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top