Skip to content Skip to sidebar Skip to footer

JQuery disable right click event

Reading Time: < 1 minute

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


In the IE, this method may not be supported.So you can use the following method.
if(event.preventDefault) {
 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: http://mootools.net/docs/core/Types/DOMEvent