<command>


HTML <command> Tag

Instance

<!DOCTYPE html>
<html>
<head>
<script>
function save()
{
alert("Some javaScript....");
}
</script>
</head>
<body>

<menu>
<command type="command" label="Save" onclick="save()">Save</command>
</menu>

<p><b>Note:</b> The command element is currently only supported in IE9.</p>

</body>
</html>

Run Example»

Click the "Run Instance" button to view the online instance


Browser support

1000.png

Currently, none of the mainstream browsers support it <command> tag.

Note: Only IE 9 supports the <command> tag. Other previous or later versions of IE browsers do not support the <command> tag.


Tag definition and usage instructions

<command> Tags can define commands that users may call (such as radio buttons, check boxes, or buttons).

When using the <menu> element, the command element will be displayed as part of the menu or toolbar. However, when using command to specify keyboard shortcuts, the command element can be placed anywhere on the page, but the element will not be visible.


Differences between HTML 4.01 and HTML5

The<command> tag is a new tag in HTML 5.


Attribute

New: New attribute in HTML5.

AttributesValueDescription
checkedNew checkedSpecifies whether the command is selected when the page is loaded. Only for radio or checkbox types.
disabledNewdisabledSpecifies whether command is available.
iconNewURLSpecifies the URL of the image to be displayed as a command.
labelNewtextRequired. Specifies the name of the command, visible to the user.
radiogroupNewgroupname#Specifies that the command that can be switched and will be switched belongs to group name. Only used when type is radio.
typeNewcheckbox
command
radio
Define the type of command. The default is "command".

Global attributes

The<command> tag supports global attributes of HTML.


Event attributes

<command> tag supports HTML event attributes.