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.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.