Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
149
rated 0 times [  151] [ 2]  / answers: 1 / hits: 190179  / 13 Years ago, wed, october 19, 2011, 12:00:00
 document.getElementById('frmMain').elements


can i use like this



document.getElementByName('frmMain').elements 


or



document.getElementBytag('table').elements`

More From » javascript

 Answers
14

  • document.getElementById('frmMain').elements

    assumes the form has an ID and that the ID is unique as IDs should be. Although it also accesses a name attribute in IE, please add ID to the element if you want to use getElementById
















A great alternative is










In all of the above, the .elements can be replaced by for example .querySelectorAll([type=text]) to get all text elements


[#89541] Monday, October 17, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ellisw

Total Points: 625
Total Questions: 92
Total Answers: 88

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
ellisw questions
Mon, Aug 23, 21, 00:00, 3 Years ago
Fri, Nov 20, 20, 00:00, 4 Years ago
Sat, Jun 20, 20, 00:00, 4 Years ago
Tue, Apr 21, 20, 00:00, 4 Years ago
;