IHTMLInputElement::checked Property

Sets or retrieves the state of the check box or radio button.

Syntax

HRESULT IHTMLInputElement::get_checked(VARIANT_BOOL *p);
HRESULT IHTMLInputElement::put_checked(VARIANT_BOOL v);

Parameters

  • p
    Pointer to a variable of type VARIANT_BOOL that receives one of the values listed in Possible Values.
  • v
    VARIANT_BOOL that specifies one of the values listed in Possible Values.

Possible Values

false Default. Control is not selected.
true Control is selected.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Check boxes that are not selected do not return their values when the form is submitted.

A user can select a radio button only if the button has a IHTMLInputElement::name. To clear a selected radio button, a user must select another button in the set.

Windows Internet Explorer 8 and later. In IE8 Standards mode, parsing operations on the IHTMLInputElement::checked content attribute always affect both the IHTMLInputElement::checked content attribute and IHTMLInputElement::defaultChecked  Document Object Model (DOM) attribute. For example, removeAttribute('checked') sets both IHTMLInputElement::checked and IHTMLInputElement::defaultChecked to VARIANT_FALSE. Similarly, setAttribute('checked', 'checked') sets both DOM attributes to VARIANT_TRUE (as if the element was being re-parsed) For more information on IE8 mode, see Defining Document Compatibility.

See Also

IHTMLInputElement::defaultChecked, Introduction to Forms