A single choice in a menupopup
element. It acts much like a button
but it is rendered on a menu
.
More information is available in the XUL tutorial.
<menulist> <menupopup> <menuitem label="option 1" value="1"/> <menuitem label="option 2" value="2"/> <menuitem label="option 3" value="3"/> <menuitem label="option 4" value="4"/> </menupopup> </menulist>
accesskey
label
attribute for the element.
allowevents
autocheck
true
or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false
, the checked state must be adjusted manually. When autocheck is true, the button type should be "checkbox" or "radio".checked
hasAttribute()
to determine whether this attribute is set instead of getAttribute()
.type
attribute must be set to checkbox
or radio
for this attribute to have any effect.checked
attribute is set to true
, and you persist its value via the persist
attribute, Mozilla will fail to persist its value when the menuitem
is unchecked because of bug 15232. A workaround is to set the autocheck
attribute to false
, then programmatically set the checked
attribute when the user selects the item, and set it to false
instead of removing the attribute (i.e. do menuitem.setAttribute("checked", "false")
instead of menuitem.removeAttribute("checked"))
when the user unchecks the menuitem
, as a value of false
will both correctly hide the checkmark and persist its hidden state.crop
crop
attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.start
end
left
right
center
none
none
and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none
:menupopup > menuitem, menupopup > menu { max-width: none; }
description
disabled
command
event will not fire. In the case of form elements, it will not be submitted. Do not set the attribute to true
, as this will suggest you can set it to false
to enable the element again, which is not the case.
disabled
attribute is allowed only for form controls. Using it with an anchor tag (an <a>
link) will have no effect.disabled
property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state.selected
selectedIndex
or selectedItem
property of the containing element.tabindex
tab
" key. Elements with a higher tabindex
are later in the tab sequence.validate
always
never
value
menulist
elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user.
accessibleType
labelElement
label
elementlabel
element associated with the control. This is set when a label has a control
attribute pointing to this element. This property will be null
when no label is associated with the control.parentContainer
menu
elementmenu
element, or null
if there isn't a containing menu.selected
true
if this element is selected, or false
if it is not. This property is read only. This property is available for menuitem
and menuseparator
elements in Firefox 3.value
value
attribute. For textbox
and user editable menulist
elements, the contents, as visible to the user, are read and set using the Textbox.value
and Menulist.value syntax.
Inherited Properties |
menuitem-iconic
menuitem
. Specify the image using the image
attribute.menuitem-non-iconic
menuitem
s have a margin to the left for an image or checkmark. This class may be used to remove this margin so that the menuitem appears on the left edge of the menupopup.menu
, menubar
, menulist
, menupopup
, menuseparator
nsIAccessibleProvider
, nsIDOMXULContainerItemElement
, nsIDOMXULSelectControlItemElement