JSFiddle - React, Tailwind, and code Playground
HTML
<div id="divID" style="width:100px;height:100px;border:1px solid red;">
JavaScript
$(document).bind("contextmenu", function (event) {
event.preventDefault();
});
$(document).on("touch","#divID",function (e) {
if ($(".context-menu").length != 0) {
$(".context-menu").remove();
}
if (e.button == 2) {
event.preventDefault();
$("<div class='context-menu'>" +
"<ul>" +
"<a href=javascript:null onclick=''><li>Do Somthing</li></a>" +
"</ul>" +
"</div>")
.appendTo($(this))
.css({ top: event.pageY + "px", left: event.pageX + "px" });
return false;
}
return true;
});