Form methods and properties

JavaScript has a few built-in methods and properties for dealing with forms. Three of them are especially important:

                  You can submit a form by using the submit() method. To submit the first form on
the page, do


                  Please note that when a form is submitted by JavaScript the onsubmit event handler
is never executed. To reset the form, do


                   I assume, but have not tested, that the onreset event handler isn’t executed
either if you reset the form through JavaScript. Finally, you can change the ACTION of a form if you want to:

document.forms[0].action = ‘’;

                    This can come in very handily if a form has to be submitted to another script in some

Like to share it

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *