JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.min.js"></script>
<link rel="stylesheet" href="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.min.css">
<button type="button" id="testMenu">Test</button>
JavaScript
var _callback = function(key, opt)
{
var txt = "opt.$node IS " ;
if (opt.$node === undefined)
{
txt += "UNDEFINED" ;
}
else if (opt.$node === null)
{
txt += "NULL" ;
}
else
{
txt += "DEFINED" ;
}
alert(txt) ;
} ;
jQuery.contextMenu({
selector: "#testMenu",
items:
{
"item1":
{
name: "item 1",
callback: _callback,
},
"item2":
{
name: "item 2",
callback: _callback,
},
}
}) ;