Posted By

laxman2021 on 11/28/12


Tagged

form javascript clear with


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Beppoi


Clear form with JavaScript


 / Published in: JavaScript
 

URL: http://www.redips.net/javascript/clear-form/

JavaScript is the only option, if you want to have the ability to clear all form fields. Yes, HTML form has Reset method, but if the form has initial values, then Reset will return the form to the initial state instead of clear input fields. This example also shows how to create an access loop for each form element. You can uncomment alert before "switch" line and you will see the message before element value is cleared. Drop down select-one will be set to its first option because it can not be treated like input text field or select-multiple

Report this snippet  

You need to login to post a comment.