Reset all form elements to their default values in Javascript.

Virendradugar
Posted by Virendradugar under JavaScript category on | Views : 4833
Javascript provides a method "reset" which will reset all the control of the page to their default values.

<script type="text/javascript" language="javascript">
function ResetForm(){
document.all.myForm.reset();
}
</script>


Note : myForm is the Id of the form used in the page. However above code will only work for IE.

For other browsers

document.formID.reset()


Thanks,
Virendra Dugar

Comments or Responses

Login to post response