JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/js/theme.js"></script>
<span class="context-menu-one btn btn-neutral">right click me</span>
JavaScript
$(function(){
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "clicked: " + key;
window.console && console.log(m) || alert(m);
},
items: {
"changeCB": {
name: "ChangeCheckBox",
type: 'checkbox',
selected: true,
events: {
click: function(e) {
var $input = $(this);
var $item = $input.closest('li');
var data = $item.data();
if ($input.prop('checked')){
//WHEN CHECKED -> "DoOther" enable
}else{
//WHEN UNCHECKED -> "DoOther" disable
}
}
}
},
"DoOther": {
name: "Do Other function",
disabled: function(key, opt) {
// this references the trigger element
return !this.data('cutDisabled');
}
}
}
});
});