How can I iterate through all forms in a document using javascript?
You can use
document.forms
collection
See forms Collection
The code below will go through an html document, get all forms and do a pop-up alert of the names of each form.
var formsCollection = document.getElementsByTagName("form");
for(var i=0;i<formsCollection.length;i++)
{
alert(formsCollection[i].name);
}
This is just a start to see if you are getting the reult you require. Thereafter, remove the alert and continue to do what you need to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With