Latest web development tutorials

jQuery UI example - menu (Menu)

Interacting with the mouse and keyboard can be used to navigate the menu theming.

For more details about the menu components, see the API documentation menu components (the Widget Menu) .

The default function

With a default configuration, disable the nested menu entries and menu. It consists of a list of converted and added themes and supports mouse and keyboard interaction. Try using the cursor keys to navigate the menu.

<! Doctype html>
<Html lang = "en">
<Head>
  <Meta charset = "utf-8">
  <Title> jQuery UI menu (Menu) - The default function </ title>
  <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script>
  <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script>
  <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css">
  <Script>
  $ (Function () {
    $ ( "#menu") .menu ();
  });
  </ Script>
  <Style>
  .ui-menu {width: 150px;}
  </ Style>
</ Head>
<Body>
 
<Ul id = "menu">
  <Li class = "ui-state-disabled"> <a href="#"> Aberdeen </a> </ li>
  <Li> <a href="#"> Ada </a> </ li>
  <Li> <a href="#"> Adamsville </a> </ li>
  <Li> <a href="#"> Addyston </a> </ li>
  <Li>
    <a href="#"> Delphi </a>
    <Ul>
      <Li class = "ui-state-disabled"> <a href="#"> Ada </a> </ li>
      <Li> <a href="#"> Saarland </a> </ li>
      <Li> <a href="#"> Salzburg </a> </ li>
    </ Ul>
  </ Li>
  <Li> <a href="#"> Saarland </a> </ li>
  <Li>
    <a href="#"> Salzburg </a>
    <Ul>
      <Li>
        <a href="#"> Delphi </a>
        <Ul>
          <Li> <a href="#"> Ada </a> </ li>
          <Li> <a href="#"> Saarland </a> </ li>
          <Li> <a href="#"> Salzburg </a> </ li>
        </ Ul>
      </ Li>
      <Li>
        <a href="#"> Delphi </a>
        <Ul>
          <Li> <a href="#"> Ada </a> </ li>
          <Li> <a href="#"> Saarland </a> </ li>
          <Li> <a href="#"> Salzburg </a> </ li>
        </ Ul>
      </ Li>
      <Li> <a href="#"> Perch </a> </ li>
    </ Ul>
  </ Li>
  <Li class = "ui-state-disabled"> <a href="#"> Amesville </a> </ li>
</ Ul>
 
 
</ Body>
</ Html>

icon

Menu with a default configuration that shows how to use the menus with icons.

<! Doctype html>
<Html lang = "en">
<Head>
  <Meta charset = "utf-8">
  <Title> jQuery UI menu (Menu) - icon </ title>
  <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script>
  <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script>
  <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css">
  <Script>
  $ (Function () {
    $ ( "#menu") .menu ();
  });
  </ Script>
  <Style>
  .ui-menu {width: 150px;}
  </ Style>
</ Head>
<Body>
 
<Ul id = "menu">
  <Li> <a href="#"> <span class = "ui-icon ui-icon-disk"> </ span> save </a> </ li>
  <Li> <a href="#"> <span class = "ui-icon ui-icon-zoomin"> </ span> Enlarge </a> </ li>
  <Li> <a href="#"> <span class = "ui-icon ui-icon-zoomout"> </ span> refine </a> </ li>
  <Li class = "ui-state-disabled"> <a href="#"> <span class = "ui-icon ui-icon-print"> </ span> Print ... </a> </ li >
  <Li>
    <a href="#"> play </a>
    <Ul>
      <Li> <a href="#"> <span class = "ui-icon ui-icon-seek-start"> </ span> on a </a> </ li>
      <Li> <a href="#"> <span class = "ui-icon ui-icon-stop"> </ span> Stop </a> </ li>
      <Li> <a href="#"> <span class = "ui-icon ui-icon-play"> </ span> Play </a> </ li>
      <Li> <a href="#"> <span class = "ui-icon ui-icon-seek-end"> </ span> next </a> </ li>
    </ Ul>
  </ Li>
</ Ul>
 
 
</ Body>
</ Html>