Skip links

JQuery disable right click event

Q-I want to disable right click event in my web pages. This can be done by using JQuery preventDefault() function.Here is a example, it working for all web browsers.
The preventDefault() method stops the default action of an element from happening.

    JQuery disable right click

    Disable right click event

[stextbox id=”info”]In the IE, this method may not be supported.So you can use the following method.[/stextbox]

if(event.preventDefault) {
else {
 event.returnValue = false;
// Simply above this
 event.preventDefault ? event.preventDefault() : event.returnValue = false;

According to above, event.preventDefault() just like return false;
More info: