Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
-1
rated 0 times [  1] [ 2]  / answers: 1 / hits: 20766  / 15 Years ago, wed, january 27, 2010, 12:00:00

How can I iterate through all forms in a document using javascript?


More From » dom

 Answers
184

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.


[#97737] Sunday, January 24, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
valentinam

Total Points: 166
Total Questions: 117
Total Answers: 81

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;