Answers for "how to add a right click listener javascript"

1

how to add a right click listener javascript

element.addEventListener('contextmenu', (e) => {
	e.preventDefault();
    alert('Success');
}, false);
Posted by: Guest on January-09-2021
-2

javascript event right click

function rightclick() {
    var rightclick;
    var e = window.event;
    if (e.which) rightclick = (e.which == 3);
    else if (e.button) rightclick = (e.button == 2);
    alert(rightclick); // true or false, you can trap right click here by if comparison
}
Posted by: Guest on November-03-2020

Code answers related to "how to add a right click listener javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language