Build jQuery UI Menu - Icons in JavaScript

Description

The following code shows how to build jQuery UI Menu - Icons.

Example


<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Menu - Icons</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<!-- w  ww  . ja  va  2  s  . c  om-->
<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>Zoom In</a></li>
<li><a href="#"><span class="ui-icon ui-icon-zoomout"></span>Zoom Out</a></li>
<li class="ui-state-disabled"><a href="#"><span class="ui-icon ui-icon-print"></span>Print...</a></li>
<li>
<a href="#">Playback</a>
<ul>
<li><a href="#"><span class="ui-icon ui-icon-seek-start"></span>Prev</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>

<div class="demo-description">
<p>A menu with the default configuration, showing how to use a menu with icons.</p>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Build jQuery UI Menu - Icons in JavaScript
Home »
  Javascript Tutorial »
    jQuery UI »
      Menu
Javascript Tutorial Menu
Build jQuery UI Menu - Default functionalit...
Build jQuery UI Menu - Icons in JavaScript