Register now or log in to join your professional community.
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.
The command element is meant to encapsulate something that you can do.It provides an abstraction layer between UI and commands, so that you can make multiple UI elements refer to the same command.
<command > is a new tag added in HTML5 but still not supported in most browsers. It is used to represent a command that the user can invoke. It is almost an obsolete element that may be deprecated in the coming few years.
It provides the layer of abstraction between UI (menu items, buttons, and links) & Command With command you can target multiple UI elements with same command this will allow single feature to many access point.
The command tag was introduced in HTML5 but later removed & not recommended to use.
the <command> element is meant to be an abstraction to let us refer to the same "command" from multiple menu entries or buttons.
the <command> can be part of a context menu or toolbar, using the menu element, or can be put anywhere else in the page, to define a keyboard shortcut.
The type attribute is currently not supported in any of the major browsers. The <command> element has now been dropped from the HTML5 specification. Therefore, you should not use it in your HTML markup.
There are3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes. The attributes that you can add to this tag are listed below.
<command type="command|checkbox|radio">
If a <command> element slave has a command attribute, and slave is in a Document, and there is an element in that Document whose ID has a value equal to the value of slave's command attribute, and the first such element in tree order, hereafter master, itself defines a command and either is not a <command> element or does not itself have a command attribute, then the master command of slave is master.
An element with a command attribute must have a master command and must not have any type, label, icon, disabled, checked, or radiogroup attributes.
<command type="command" label="Save" onclick="save()">Save</command>
<menu><command type="command" label="Save" onclick="save()">Save</command></menu>
Source - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/command