Command Tag (Part of a Context Menu) in HTML5


A Command tag is a new tag introduced in HTML5. It is used to represent a command that the user can invoke like a radiobutton, a checkbox and a button or any other button that the user can interact with. It is part of a toolbar or context menu. This tag must be inside a menu tag. It will not work outside the menu tag. Types of command tags are command, checkbox and radio. Type attribute indicates the kind of command. This tag is currently supported in any version of IE and Safari. Commands can also be turned into check boxes with a checked="checked" attribute.Syntax
<command
class contenteditable contextmenu default disabled draggable hidden icon id itemid itemprop itemref itemscope
itemtype="microdata type in URL format"
label lang radiogroup spellcheck style tabindex title type> Text Here
</command>

Element-Specific Attributes
Attributes Values Description
checked checked This is a Boolean attribute used only when the type is a radio or a checkbox and specifies if the command is checked or not.
disabled disabled This is a Boolean attribute that indicates that the command is available or not available in the current form.
icon url This attribute used to defines the url of an graphical image to display as the command. It should contain a valid non empty URL.
label name This attribute display the command name to users.
radiogroup radiogroup This attribute specifies the name of the group of it belongs to. It is used only with radio type.
type checkbox
command
radio
This attribute defines the specify type of command. Command is default value.

HTML5 Event Attributes

onabort onblur oncanplay
oncanplaythrough onchange onclick
oncontextmenu ondblclick ondrag
ondragend ondragenter ondragleave
ondragover ondragstart ondrop
ondurationchange onemptied onended
onerror onfocus onformchange
onforminput oninput oninvalid
onkeydown onkeypress onkeyup
onload onloadeddata onloadedmetadata
onloadstart onmousedown onmousemove
onmouseout onmouseover onmouseup
onmousewheel onpause onplay
onplaying onprogress onratechange
onreadystatechange onseeked onseeking
onscroll onselect onshow
onstalled onsubmit onsuspend
ontimeupdate onvolumechange onwaiting


Code:
Output

Internet Explorer

Command Tag

When you click on second Command2 text. You will get message box.

Command Tag

There is editable_content text. When you click on that first one message box appear click on OK button after that you can edit text. You can write any thing there.

Command Tag

Safari

Command Tag

When you click on second Command2 text. You will get message box.

Command Tag

There is editable_content text. When you click on that first one message box appear click on OK button after that you can edit text. You can write any thing there.

Command Tag

Up Next
    Ebook Download
    View all
    Learn
    View all