Pure JavaScript Context Menu Plugin ContextMenu.js

Category: Javascript , Menu & Navigation | July 21, 2017
Views Total:1,394 views
Official Page:Go to website
Last Update:July 21, 2017


Pure JavaScript Context Menu Plugin ContextMenu.js


ContextMenu.js is a vanilla JavaScript plugin that adds a simple right click context menu to any container without the need of any 3rd JS libraries.

How to use it:

Load the required stylesheet contextMenu.css that contains the primary CSS styles for the context menu.

<link href="contextMenu.css" rel="stylesheet">

Add the CSS class ‘contextMenu-target’ to any container you want to display the context menu.

<tr id='2' class='contextMenu-target'>
  <td>[email protected]</td>

Load the JavaScript file ‘contextMenu.js’ at the end of the document.

<script src="contextMenu.js"></script>

Initialize the plugin and you’re done.

document.addEventListener("DOMContentLoaded", function (event) {
  contextmenu = new ContextMenu();

You Might Be Interested In:

Leave a Reply