HTML <menuitem> tag
Example
Contains context menus with different <menuitem> elements:
<menu type="context" id="mymenu"> <menuitem label="Refresh" onclick="window.location.reload();" icon="ico_reload.png"> </menuitem> <menu label="Share on..."> <menuitem label="Twitter" icon="ico_twitter.png" onclick="window.open('//twitter.com/intent/tweet?text='+window.location.href);"> </menuitem> <menuitem label="Facebook" icon="ico_facebook.png" onclick="window.open('//facebook.com/sharer/sharer.php?u='+window.location.href);"> </menuitem> </menu> <menuitem label="Email This Page" onclick="window.location='mailto:?body='+window.location.href;"></menuitem> </menu>
Browser support
IE | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
Firefox 8.0 and later versions support the <menuitem> tag.
Definition and usage
The <menuitem> tag defines a command/menu item that the user can call from a popup menu.
Differences between HTML 4.01 and HTML 5
<menuitem> is a new tag in HTML5.
Attribute
new : A new attribute in HTML5.
Attribute | Value | Description |
---|---|---|
checked | checked | Select the command/menu item after the page is loaded. Only applicable for type="radio" or type="checkbox". |
default | default | Sets the command/menu item as the default command. |
disabled | disabled | Specifies that the command/menu item should be disabled. |
icon | URL | Specifies the icon for the command/menu item. |
open | open | Defines whether details are visible. |
label | text | Required. Specifies the name of the command/menu item to be displayed to the user. |
radiogroup | groupname | Specifies the name of the command group, which will be toggled when the command/menu item itself is toggled. Only applicable for type="radio". |
type |
|
Specifies the type of command/menu item. The default is "command". |
Global Attributes
Support for <menuitem> tag Global Attributes in HTML.
Event Attributes
Support for <menuitem> tag Event Attributes in HTML.
Related Pages
HTML DOM Reference Manual:MenuItem Object