The HTMLFormElement.elements
property returns an HTMLFormControlsCollection
(HTML 4 HTMLCollection
) of all the form controls contained in the FORM element, with the exception of input
elements which have a type
attribute of image
.
You can access a particular element by using either an index or the element name or id.
nodeList = HTMLFormElement.elements
var inputs = document.getElementById("form1").elements; var inputByIndex = inputs[2]; var inputByName = inputs["login"];
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLFormElement.elements' in that specification. | Living Standard | |
Document Object Model (DOM) Level 2 HTML Specification The definition of 'HTMLFormElement.elements' in that specification. | Obsolete | Initial definition |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements