Latest web development tutorials
 

HTML DOM MenuItem Object


MenuItem Object

The MenuItem Object is new in HTML5.

The MenuItem object represents an HTML <menuitem> element.

Note: The <menuitem> element is currently ONLY supported in Firefox.

Access a MenuItem Object

You can access a <menuitem> element by using getElementById():

var x = document.getElementById("myMenuItem");

Create a MenuItem Object

You can create a <menuitem> element by using the document.createElement() method:

var x = document.createElement("MENUITEM");

MenuItem Object Properties

Property Description
checked Sets or returns whether the menu item should be checked
command Sets or returns the value of the command attribute of the menu item
default Sets or returns whether the menu item should be the default command
disabled Sets or returns whether the menu item should be disabled
icon Sets or returns an image that represents the menu item
label Sets or returns the value of the label attribute of the menu item
radiogroup Sets or returns the value of the radiogroup attribute of the menu item
type Sets or returns the value of the type attribute of the menu item

Standard Properties and Events

The MenuItem object also supports the standard properties and events.


Related Pages

HTML reference: HTML <menitemu> tag