{{obsolete_header()}}
Note: The command
element has been removed from {{Gecko("24.0")}} in favor of the {{HTMLElement("menuitem")}} element. Firefox has never supported this command
element, and the existing implementation of the {{domxref("HTMLCommandElement")}} DOM interface has been dropped from Firefox 24.
Summary
The command
element represents a command which the user can invoke.
- Content categories Flow content, phrasing content, metadata content.
- Permitted content None, this is a void element.
- Tag omission The start tag is mandatory, but, as it is a void element, the use an end tag is forbidden.
- Permitted parent elements {{HTMLElement("colgroup")}} only, though it can be implicitly defined as its start tag is not mandatory. The {{HTMLElement("colgroup")}} must not have a {{HTMLElement("span")}} as child.
- DOM interface {{domxref("HTMLCommandElement")}} {{ obsolete_inline(24) }}
Attributes
This element includes the global attributes.
- {{htmlattrdef("checked")}}
-
Indicates whether the command is selected. Must be omitted unless the
type
attribute ischeckbox
orradio
. - {{htmlattrdef("disabled")}}
- Iindicates that the command is not available.
- {{htmlattrdef("icon")}}
- Gives a picture which represents the command.
- {{htmlattrdef("label")}}
- The name of the command as shown to the user.
- {{htmlattrdef("radiogroup")}}
-
This attribute gives the name of the group of commands, with a
type
ofradio
, that will be toggled when the command itself is toggled. This attribute must be omitted unless thetype
attribute isradio
. - {{htmlattrdef("type")}}
-
This attribute indicates the kind of command. This can be one of three values.
-
command
or empty which is the default state and indicates that this is a normal command. -
checkbox
indicates that the command can be toggled using a checkbox. -
radio
indicates that the command can be toggled using a radiobutton.
-
Examples
<command type="command" label="Save" icon="icons/save.png" onclick="save()">
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'interactive-elements.html#the-command-element', '<command>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'the-command-element.html#the-command-element', '<command>')}} | {{Spec2('HTML5 W3C')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
{{ HTML:Element_Navigation() }}