w3resource logo

HTML5 command element

HTML5 command Element Tutorial

Secondary Nav


HTML5 command element represents a command which can be called or executed by user.


<command type="command | empty | radio | checkbox" label="name" icon="image" HTMLEvent="JavaScript_Function_Name">

Whether start and end tag are required

It must have a start tag. And should not have an end tag.

What an command element can contain

This is a void element. So, it can not contain any content.

Which elements can contain command element

Any element that accepts phrasing content.


Following table shows the detail of attributes supported by command element.

checkedThis attribute can be used if the value of the type attribute is checkbox or radio. This attribute indicates whether the associated command is selected.
disabledIf used, it is an indication that the command is not available.
iconAn image representing the command.
labelA name given to the command for users.
radiogroupCan be used if the value of the type attribute is radio. It gives the name of the group of commands.
type Indicates the type of the command. Values can be empty, command, checkbox, radio. If the command or empty, it indicates that this is a normal command. This is also the default. If the value is a checkbox, it indicates that the command is usable through a checkbox. And if the value is radio, then the command can be used through a radio.

Example :

<!doctype html>
<title>HTML5 command example</title>
function run(){
alert('welcome to w3resource');
<command type="command" label="Run" icon="run.png" onclick="run()">


Command element is not supported by any of the major and most widely used browsers till now.

Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program