YUI Library Home

YUI Library Examples: Menu Family: Setting Menu Configuration Properties At Runtime

Menu Family: Setting Menu Configuration Properties At Runtime

This example demonstrates how to set MenuItem configuration properties at runtime and listen for the changes through the "configChanged" event.

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

Setting MenuItem configuration properties at runtime

A MenuItem has a number of configuration properties that affect its behavior and visual rendering. Any of these configuration properties can be set at runtime via the setProperty method of the item's configuration object (accessible via its cfg property.

This example ulitizes the following configuration properties: text, selected, disabled, helptext, url, emphasis, strongemphasis, and checked.

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

YUI Logger Output:

Menu Family Examples:

More Menu Family Resources:

Copyright © 2011 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings