HTML <command>Tag


Examples

The <command> element can be marked as follows:

<menu>
<command type="command" label="Save" onclick="save()">Save</command>
</menu>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Currently, mainstream browsers do not support the <command> tag.

Note:Only IE 9 supports the <command> tag; other earlier or later versions of IE do not support the <command> tag.


Definition and Usage

The <command> tag defines a command that a user can invoke (such as a radio button, checkbox, or button).

When the <menu> element is used, the command element will be displayed as part of a menu or toolbar. However, when command is used to specify keyboard shortcuts, the command element can be placed anywhere on the page, but the element is invisible.


Differences Between HTML 4.01 and HTML5

The <command> tag is new in HTML5.


Attributes

New: New attributes in HTML5.

Attribute Value Description
checkedNew checked Specifies whether the command is selected when the page loads. Only used for radio or checkbox types.
disabledNew disabled Specifies whether the command is available.
iconNew URL Specifies the URL of the image displayed as the command.
labelNew text Required. Specifies the name of the command, visible to the user.
radiogroupNew groupname Specifies the group name of the command that can be toggled and will be toggled. Only used when the type is radio.
typeNew checkbox
command
radio
Defines the type of command. The default is "command".

Global Attributes

The <command> tag supportsHTML Global Attributes。


Event Attributes

The <command> tag supportsHTML Event Attributes。

Other Extensions