javascript detect right click
el.addEventListener('contextmenu', function(ev) {
ev.preventDefault();
alert('success!');
return false;
}, false);document.body.onclick = function (e) {
var isRightMB;
e = e || window.event;
if ("which" in e) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB = e.which == 3;
else if ("button" in e) // IE, Opera
isRightMB = e.button == 2;
alert("Right mouse button " + (isRightMB ? "" : " was not") + "clicked!");
}
Also in JavaScript:
- flask javascript not updating
- javascript recursion over array
- submitting login and sign up forms using AJAX
- jquery datatable returning current datetime
- disable input field from jquery
- json.stringify pretty
- js create array from for loop
- javascript loop if statement
- parse tree for expression
- array.includes js
- js code to run hello world
- how to comments in json file
- how to check if value is undefines if condition jquery
- tick.json code
- check palindrome js
- get div id javascript
- break loop timeout javascript
- js conditional array element
- axios download excel \ file
- document.addEventListener("load", function () {
- kendo datetime picket default timezone
- js alert
- how to make unclicable legend chartjs
- how to make and add to an array in javascript