IHTMLFormElement::elements Property

Retrieves an interface pointer to a zero-based collection of the elements in the form.


HRESULT IHTMLFormElement::get_elements(IDispatch **p);


Address of a pointer to an IDispatch interface that receives the zero-based collection of the elements in the form.

Return Value

Returns S_OK if successful, or an error value otherwise.


Windows Internet Explorer 8 and later. In IE8 Standards mode, collections pointed to by p do not implement the HTMLCollection interface. For more information on IE8 mode, see Defining Document Compatibility.

The pointer provides access to the properties and methods of the elements. The order of the elements in the collection is determined by the HTML source.

Call QueryInterface on the IDispatch retrieved by this method to obtain an IHTMLElementCollection interface.

The collection retrieved by the IHTMLFormElement::elements property does not include input type=image elements from a form. To access all elements contained in a form, call QueryInterface on IHTMLFormElement and request an IHTMLElement interface. Use the IHTMLElement::children property of the IHTMLElement interface to retrieve a collection of all elements in the form.

Community Additions