getElementById method

Returns a reference to the first object with the specified ID value.

Syntax

var ppRetElement = document.getElementById(bstrId);

Parameters

  • bstrId [in]
    Type: BSTR

    A BSTR that specifies the ID, which is case sensitive.

  • ppRetElement [out, retval]
    Type: [IHTMLElement2](aa703984(v=vs.85).md)

    The address of a pointer to a variable of type IHTMLElement2 that receives the first object with the ID specified in bstrId.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This version of IHTMLDocument6::getElementById requires IE8 Standards mode compatibility. For more information, see Defining Document Compatibility

See also

document

IHTMLDocument3::getElementById