HTML COMMAND Tag

The command tag was introduced in HTML5, and with time it was removed too. This tag was used to define the command button, such as a radio button, check box, or button.

You could use the COMMAND tag in conjunction with the MENU tag.

The COMMAND tag could also be used without the MENU tag, but only to list the keyboard shortcuts.

Attributes of the COMMAND tag

The following table shows the attributes of the COMMAND tag:

Attribute Description
checked defines the command selection in the case of a radio button or checkbox.
disabled disables the command
icon specifies the location of the graphical image that represents the command.
label shows the name of the command to the user.
radiogroup specifies the name of the group if the command type radio is defined.
type defines the command type, such as command (default), checkbox, and radio.

The value of the "type" attribute of the "COMMAND" tag can be any of the following:

From all the three values, "command" is the default one.

Now would be a good time to take one or two examples of the "COMMAND" tag so that we can wrap up our conversation about it. Because I don't believe it's worthwhile to do so, I won't go into further detail about the "COMMAND" tag, which has been removed from HTML5.

An example of a command tag

Following is an example of using the COMMAND tag:

<MENU>
   <COMMAND type="command">Execute</COMMAND>
</MENU>

The COMMAND tag is a new tag that was introduced in HTML5 and is used to execute a command when an event is fired by a form control such as a radio button or checkbox. This tag can also be used to execute a command in response to a user clicking on a radio button or checkbox. The command tag can be used with the context menu or the toolbar, respectively.

The use of the COMMAND tag is also demonstrated in the fragment of HTML code that follows:

<MENU label="Cars">
   <COMMAND type="radio" radiogroup="cars" label="Lamborghini">
   <COMMAND type="radio" radiogroup="cars" label="Ferrari">
</MENU>

HTML Online Test


« HTML Tutorial CodesCracker.com »


Liked this post? Share it!