JSFiddle - React, Tailwind, and code Playground
HTML
<div id='right'>HELLOO THERE!!
<br/>
<br/>
<br/>
<br/>
THIS IS A TEST!</div>
JavaScript
(function( $ ) {
$.fn.rightClick = function(method) {
$(this).bind('contextmenu rightclick', function(e){
e.preventDefault();
method();
return false;
})
};
})( jQuery );
$('#right').rightClick(function(e){
alert('hi there!');
});