O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Menu

. . . jQuery . . . $( "#menu" ).menu(); $( "#menu" ).on("menuselect", function(e, ui){   $("p").html("Selected " +     ui.item.children("a:first").html()); }); . . . HTML . . . <ul id="menu">   <li><a href="#">Open</a></li>   <li><a href="#">Recent</a><ul> . . .   <li class="ui-state-disabled"><a href="#">

One of the most often used jQuery UI widgets is the menu widget. The menu widget allows you to turn an element tree into an expanding menu. Typically, menus are created by using cascading sets of <ul>/<li> elements with an <a> element that defines the link behavior and menu text.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required