HTML5 <command> Tag

Example

A button is marked up as follows:

<menu>
<command onclick="alert('Hello World')">
Click Me!</command>
</menu>

Try it yourself »

Definition and Usage

The <command> tag defines a command button, like a radiobutton, a checkbox, or a button.

The command element is only visible if it is inside a menu element. If not, it will not be displayed, but can be used to specify a keyboard shortcut.


Differences Between HTML 4.01 and HTML5

The <command> tag is new in HTML5


Attributes

New : New in HTML5.

Attribute Value Description
checkedNew checked Defines if the command is checked or not. Use only if type is radio or checkbox
disabledNew disabled Defines if the command is available or not
iconNew url Defines the url of an image to display as the command
labelNew name Defines a name for the command. The label is visible
radiogroupNew radiogroup Defines the name of the radiogroup this command belongs to. Use only if type is radio
typeNew checkbox
command
radio
Defines the type of command. Default value is command

Standard Attributes

The <command> tag also supports the Standard Attributes in HTML5.


Event Attributes

The <command> tag also supports the Event Attributes in HTML5.