HTML5 command Element Tutorial
Command Element
HTML5 command element represents a command which can be called or executed by user.
Usage
<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.
Attributes
Following table shows the detail of attributes supported by command element.
Attribute | Description |
---|---|
checked | This attribute can be used if the value of the type attribute is checkbox or radio. This attribute indicates whether the associated command is selected. |
disabled | If used, it is an indication that the command is not available. |
icon | An image representing the command. |
label | A name given to the command for users. |
radiogroup | Can 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>
<html>
<head>
<title>HTML5 command example</title>
<script>
function run(){
alert('welcome to w3resource');
}
</script>
</head>
<body>
<command type="command" label="Run" icon="run.png" onclick="run()">
</body>
</html>
Compatibility
Command element is not supported by any of the major and most widely used browsers till now.
Previous: HTML5 Canvas Element Tutorial
Next: HTML5 : Datalist Element Tutorial
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html5/command-element.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics