Name

command — HTML5

Synopsis

HTML: <command>; XHTML: <command/> or <command />

Used within a menu element, a command is an interactive element that represents an immediate action that can be triggered by the user (usually via onclick).

Notes

HTML5 only.

Start/End Tags

This is an empty element. It must be closed with a trailing slash in the XML serialization of HTML5.

Attributes

HTML5 Global Attributes

checked (checked="checked" in XHTML5)

Indicates that a command is selected.

disabled (disabled="disabled" in XHTML5)

Indicates that a command is not available in the current state.

icon="URL"

Specifies the location of an image to be used as a button for the command.

label="text"

Provides the name of the command, as displayed to the user.

radiogroup="text"

Specifies the name of a group of commands when the command type is set to radio.

title="text"

Provides a hint describing the command to aid the user.

type="command|checkbox|radio"

Indicates the kind of command. The command keyword indicates a normal command with an associated action. checkbox indicates the command state can be toggled on or off. radio indicates the command represents the selection of one item from a list of items.

Example

<menu>
   <command onclick="cut()" label="Cut">
   <command onclick="copy()" label="Copy">
   <command onclick="paste()" label="Paste">
   <command onclick="delete()" label="Clear">
</menu>

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.