# Example: Handling Menu Click Events (YUI Library) [Examples Home]

This example demonstrates how to register a "click" event handler for a MenuItem instance. All of the events for YUI Menu are instances of YAHOO.util.CustomEvent. To register a listener for an event, use the event's "subscribe" method passing a pointer to your handler as the first argument. You can pass an argument to your event handler(s) as an additional second argument to the "subscribe" method.

Note: By default clicking outside of a menu will hide it. Additionally, menu items without a submenu or a URL to navigate will hide their parent menu when clicked. Click the "Show Menu" button below to make the menu visible if it is hidden.