HTML <menuitem> tag

  • Previous page
  • Next page

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>

Try it yourself

Browser support

IE Firefox Chrome Safari Opera

Firefox 8.0 and later versions support the <menuitem> tag.

Definition and usage

The <menuitem> tag defines commands/menubar items that users 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/menubar item after the page loads.

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 of the command/menu item.
open open Specifies whether the 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
  • checkbox
  • command
  • radio
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

  • Previous page
  • Next page