This example demonstrates how to group MenuItem instances.
Note: By default clicking outside of a Menu instance will hide it. Additionally, MenuItem instances without a submenu or a URL to navigate to will hide their parent Menu instance when clicked. Click the "Show Menu" button below to make the Menu instance visible if it is hidden.
The markup for a Menu control follows that of
YAHOO.widget.Module, with its
body element (
<div class="bd">) containing a list element
Each item in a Menu is represented by a list item element
<li class="yuimenuitem">), each of which has a
<a class="yuimenuitemlabel">) that can
contain plain text or HTML.
The body of a Menu instance can house many
to organize related items into groups.
To instantiate a Menu based on existing HTML, pass the id of its corresponding
HTML element (in this case "basicmenu") to the Menu constructor
YAHOO.widget.Menu) then call the
render method with
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.