1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
---
title: <command>
slug: Web/HTML/Element/command
tags:
- HTML
- Obsolete
- Reference
- Web
translation_of: Web/HTML/Element/command
---
<div>{{obsolete_header()}}</div>
<p><span class="seoSummary">The <strong>HTML Command element</strong> (<strong><code><command></code></strong>) represents a command which the user can invoke. Commands are often used as part of a context menu or toolbar.</span> However, they can be used anywhere on the page.</p>
<div class="note">
<p>The <code><command></code> element is included in the W3C specification, but not in the WHATWG specification, and browser support is nonexistent. You should use the {{HTMLElement("menuitem")}} element instead, although that element is non-standard and only supported in Edge and Firefox.</p>
</div>
<table class="properties">
<tbody>
<tr>
<th scope="row"><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></th>
<td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">phrasing content</a>, metadata content.</td>
</tr>
<tr>
<th scope="row">Permitted content</th>
<td>None, it is an {{Glossary("empty element")}}.</td>
</tr>
<tr>
<th scope="row">Tag omission</th>
<td>The <span>start tag</span> is mandatory, but, as it is a void element, the <span>use of an end tag</span> is forbidden.</td>
</tr>
<tr>
<th scope="row">Permitted parent elements</th>
<td>{{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.</td>
</tr>
<tr>
<th scope="row">DOM interface</th>
<td>{{domxref("HTMLCommandElement")}}</td>
</tr>
</tbody>
</table>
<h2 id="Attributes">Attributes</h2>
<p>This element includes the <a href="/en-US/docs/Web/HTML/Global_attributes">global attributes</a>.</p>
<dl>
<dt>{{htmlattrdef("checked")}}</dt>
<dd>Indicates whether the command is selected. Must be omitted unless the <code>type</code> attribute is <code>checkbox </code>or <code>radio</code>.</dd>
<dt>{{htmlattrdef("disabled")}}</dt>
<dd>Iindicates that the command is not available.</dd>
<dt>{{htmlattrdef("icon")}}</dt>
<dd>Gives a picture which represents the command.</dd>
<dt>{{htmlattrdef("label")}}</dt>
<dd>The name of the command as shown to the user.</dd>
<dt>{{htmlattrdef("radiogroup")}}</dt>
<dd>This attribute gives the name of the group of commands, with a <code>type</code> of <code>radio</code>, that will be toggled when the command itself is toggled. This attribute must be omitted unless the <code>type</code> attribute is <code>radio</code>.</dd>
<dt>{{htmlattrdef("type")}}</dt>
<dd>This attribute indicates the kind of command. This can be one of three values.
<ul>
<li>
<p><code>command</code> or empty which is the default state and indicates that this is a normal command.</p>
</li>
<li>
<p><code>checkbox</code> indicates that the command can be toggled using a checkbox.</p>
</li>
<li>
<p><code>radio</code> indicates that the command can be toggled using a radio button.</p>
</li>
</ul>
</dd>
</dl>
<h2 id="Examples">Examples</h2>
<pre class="brush: html"><command type="command" label="Save"
icon="icons/save.png" onclick="save()">
</pre>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', '#commands')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td> </td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'semantics.html#the-command-element', '<command>')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("html.elements.command")}}</p>
<p>{{ HTMLRef }}</p>
|