Is right click a Javascript event? If so, how do I use it?
Try using the which
and/or button
property
The demo
function onClick(e) {
if (e.which === 1 || e.button === 0) {
console.log('Left mouse button at ' + e.clientX + 'x' + e.clientY);
}
if (e.which === 2 || e.button === 1) {
console.log('Middle mouse button ' + e.clientX + 'x' + e.clientY);
}
if (e.which === 3 || e.button === 2) {
console.log('Right mouse button ' + e.clientX + 'x' + e.clientY);
}
if (e.which === 4 || e.button === 3) {
console.log('Backward mouse button ' + e.clientX + 'x' + e.clientY);
}
if (e.which === 5 || e.button === 4) {
console.log('Forward mouse button ' + e.clientX + 'x' + e.clientY);
}
}
window.addEventListener("mousedown", onClick);
Some info here