Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 583917 of <command>

  • Revision slug: Web/HTML/Element/command
  • Revision title: <command>
  • Revision id: 583917
  • Created:
  • Creator: Scipion
  • Is current revision? No
  • Comment

Revision Content

{{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 is checkbox or radio.
{{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 of radio, that will be toggled when the command itself is toggled. This attribute must be omitted unless the type attribute is radio.
{{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', 'commands.html', '<command>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'semantics.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}}

{{ HTMLRef }}

Revision Source

<div>
 {{obsolete_header()}}</div>
<div class="note">
 <p><strong>Note:</strong> The <code>command</code> element has been removed from {{Gecko("24.0")}} in favor of the {{HTMLElement("menuitem")}} element. Firefox has never supported this <code>command</code> element, and the existing implementation of the {{domxref("HTMLCommandElement")}} DOM interface has been dropped from <a href="/en-US/docs/Site_Compatibility_for_Firefox_24">Firefox&nbsp;24</a>.</p>
</div>
<h2 id="Summary">Summary</h2>
<p>The <code>command</code> element represents a command which the user can invoke.</p>
<ul class="htmlelt">
 <li><dfn><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></dfn> <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.</li>
 <li><dfn>Permitted content</dfn> None, this is a void element.</li>
 <li><dfn>Tag omission</dfn> The <span>start tag</span> is mandatory, but, as it is a void element, the <span>use an end tag</span> is forbidden.</li>
 <li><dfn>Permitted parent elements</dfn> {{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.</li>
 <li><dfn>DOM interface</dfn> {{domxref("HTMLCommandElement")}} {{ obsolete_inline(24) }}</li>
</ul>
<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 radiobutton.</p>
   </li>
  </ul>
 </dd>
</dl>
<h2 id="Examples">Examples</h2>
<pre class="brush: html">
&lt;command type="command" label="Save" icon="icons/save.png" onclick="save()"&gt;
</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.html', '&lt;command&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'semantics.html#the-command-element', '&lt;command&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
    <td>{{CompatNo}}</td>
   </tr>
  </tbody>
 </table>
</div>
<p>{{ HTMLRef }}</p>
Revert to this revision