YouTip LogoYouTip

Att Command Checked

## HTML `` `checked` Attribute The `` element was introduced in HTML5 to represent a command that a user can invoke. The `checked` attribute is a boolean attribute used to specify that the command should be pre-selected (checked) when the page loads. --- ## Browser Support > **Warning: Deprecated and Obsolete** > > The `` element and its `checked` attribute have been **deprecated and removed** from the HTML living standard. No modern browsers (including Chrome, Firefox, Safari, Edge, and Opera) support this element or its attributes. > > For modern web development, you should use standard ``, ``, or custom elements styled with CSS and controlled via JavaScript to achieve similar functionality. --- ## Definition and Usage The `checked` attribute is a boolean attribute. When present, it specifies that the command element should be pre-selected on page load. * **Note:** The `checked` attribute can only be used when the `type` attribute of the `` element is set to `"checkbox"` or `"radio"`. --- ## Syntax ```html ``` ### XHTML Differences In XHTML, attribute minimization is forbidden. The `checked` attribute must be defined explicitly with its value: ```html ``` --- ## Code Examples ### Example: A Pre-selected Radio Command Below is an example of how the `checked` attribute was designed to be used within a `` element to pre-select a radio option: ```html Left Center Right ``` --- ## Modern Alternatives Since the `` element is obsolete, you should use standard HTML5 elements to achieve the same behavior. ### Alternative 1: Using Standard Radio Inputs To create a pre-selected option group, use standard `` elements with the `checked` attribute: ```html
``` ### Alternative 2: Using ARIA for Custom Menu Items If you are building a custom application menu or toolbar, use ARIA roles (`role="menuitemcheckbox"` or `role="menuitemradio"`) along with the `aria-checked` attribute: ```html
Left (Pre-selected)
Center
```
← Att Command DisabledAtt Colgroup Width β†’