IHTMLOptionElement::selected Property

Sets or retrieves whether the option in the list box is the default item.


HRESULT IHTMLOptionElement::get_selected(VARIANT_BOOL *p);HRESULT IHTMLOptionElement::put_selected(VARIANT_BOOL v);


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

Possible Values

VARIANT_FALSE Default. Item is not selected as the default.
VARIANT_TRUE Item is selected as the default.

Return Value

Returns S_OK if successful, or an error value otherwise.


If the property is not set, the first item is selected by default.

The property determines whether a value is submitted with the form. If the value of the control matches the default value, the control's value is not submitted. The value is submitted only when the control's value does not match the default value.

To select an item in HTML, it is not necessary to set the value of the SELECTED attribute to true. The mere presence of the SELECTED attribute set s its value to true.

See Also