Material Design Style Context Menu With jQuery - 3Dot Context Menu

File Size: 35.5 KB
Views Total: 10391
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Material Design Style Context Menu With jQuery - 3Dot Context Menu

This is a simple jQuery plugin which adds a Material Design inspired custom context menu with a vertical three dots toggle icon to any elements such as tables, paragraphs, and headings.

Basic usage:

1. Import jQuery JavaScript library and the jQuery 3Dot Context Menu plugin's files into the web page.

<script src="" 
<script src="context-menu.js"></script>
<link href="context-menu.css" rel="stylesheet">

2. Create the context menu.

<div class="context-menu-container" id="context-menu-items">
    <li>Menu Item 1</li>
    <li>Menu Item 2</li>
    <li>Menu Item 3</li>

3. Add the context-menu class and data-container-id attribute to any element in which you want to place the vertical three dots toggle icon.

<!-- Table -->
<td class="context-menu" data-container-id="context-menu-items" data-row-id="1"></td>
<td class="context-menu" data-container-id="context-menu-items" data-row-id="2"></td>

<!-- Paragraph -->
<p>Here is a context menu in a &lt;p&gt; <span class="context-menu" data-container-id="context-menu-items"></span></p>

<!-- Heading -->
<h3 class="context-menu" data-container-id="context-menu-items">Here is an h3 with a context menu</h3>

4. Bind click listener to the context menu.

  var tableContextMenu = new ContextMenu("context-menu-items", menuItemClickListener);

function menuItemClickListener(menu_item, parent)
  alert("Menu Item Clicked: " + menu_item.text() + "\nRecord ID: " + parent.attr("data-row-id"));

5. Trigger a function when opening the menu.

var tableContextMenu = new ContextMenu("context-menu-items", menuItemClickListener, {
    openCallBack: function(contextMenu) {
      console.log("Opening context menu call back called");



  • Fix multiple click binds


  • Optioanl callback now returns the parent id


  • Fixed issue with menu item onclick being passed through to parent object


  • Hide/Show Menu Items


  • Fixed issue with last update where the parent returned in the item click listener wouldn't find the attribute values.


  • Added a warning and danger CSS class to be used for the menu items so that a different colour background can be shown to warn the user of a danger of performing an action
  • Added ability to receive a call back in the event that the context menu is being opened up, this allows manipulation of the menu item before it is shown to the user, for example, disabling and enabling a menu item.
  • Added ability to enable/disable menu item from being clicked.


  • Fixed issue with context menu not opening in correct place if user was scrolled down page.
  • Fixed issue with context menu not working on Firefox

This awesome jQuery plugin is developed by BoardiesITSolutions. For more Advanced Usages, please check the demo page or visit the official website.