I have a page that loads different forms depending on user choice. I want to have a single javascript that can read all elements on any of these forms. I don’t want to have multiple scripts … I want a a function, say for example, named submit([don't know if it should have parameters]), then when any of the forms is submitted, this function is called and executed. I will be setting the submit action. But I need the function that can read any form.
I have a page that loads different forms depending on user choice. I want
Share
Consider this:
So, you cancel any submit actions on the document-level, and then do your own thing using
submit()…Use the
document.formscollection to access your forms. Use theform.elementscollection to access the elements of each form.