Documentation

Getting Started

jqxMenu represents a jQuery menu widget that makes it easy to add menus to your website or web application. With the jqxMenu you can create website menus, customized context menus, or application-style menu bars with just a small amount of scripting.
Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.

The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxMenu widget requires the following files:

<head>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css"/>
<script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>

The next step is to create a div element within the body of the html document and add UL for the menu bar and sub menus and LI elements for each menu item.
<div id='jqxmenu'>
<ul>
<li><a href="#">Home</a></li>
<li>About Us</li>
<li>Services </li>
<li>Products
<ul>
<li><a href="#">New</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Used</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Featured</a></li>
</ul>
</li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Careers</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>

The last step is to initialize the widget by adding the following script to the html document:
<script type="text/javascript">
$(document).ready(function () {
// Create a jqxMenu and set its width and height.
$("#jqxMenu").jqxMenu({ width: 300, height: 30 });
});
</script>

To call a function(method), you need to pass the method name and parameters(if any) in the jqxMenu’s constructor.
$("#jqxmenu").jqxMenu(‘openItem’, itemID);
To set a property(option), you need to pass the property name and value(s) in the jqxMenu's constructor.
$("#jqxmenu").jqxMenu({ autoOpen: false });
To get a property(option), you need to pass the property name to the jqxMenu's constructor.
var autoopen = $("#jqxmenu").jqxMenu('autoOpen');
To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the clicked menu item when the user clicks. The example code below demonstrates how to bind to the ‘itemclick’ event of jqxMenu.
$('#jqxMenu').on('itemclick', function (event) {
var clickedItem = event.args;
});

Basic Vertical Menu Sample

<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>jQuery Menu - Vertical Menu Sample</title>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
<body>
<div id='content'>
<script type="text/javascript">
$(document).ready(function () {
// Create a jqxMenu
$("#jqxMenu").jqxMenu({ width: '120', mode: 'vertical'});
});
</script>
<div id='jqxWidget'>
<div id='jqxMenu'>
<ul>
<li><a href="#">Home</a></li>
<li>About Us
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Our Vision</a></li>
</ul>
</li>
<li>Services
</li>
<li>Products
<ul>
<li><a href="#">New</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Used</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Featured</a></li>
</ul>
</li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Careers</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

The result of the above code is:

Basic Horizontal Menu Sample

<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>jQuery Menu - Horizontal Menu Sample</title>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
<body>
<div id='content'>
<script type="text/javascript">
$(document).ready(function () {
// Create a jqxMenu
$("#jqxMenu").jqxMenu({ width: 600, height: 30});
});
</script>
<div id='jqxWidget'>
<div id='jqxMenu'>
<ul>
<li><a href="#">Home</a></li>
<li>About Us
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Our Vision</a></li>
</ul>
</li>
<li>Services
</li>
<li>Products
<ul>
<li><a href="#">New</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Used</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Featured</a></li>
</ul>
</li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Careers</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

The result of the above code is:

Basic Context Menu Sample

The result of the above code is: