
How to Disable Right Click Using jQuery in HTML Page?
Method 1 – To Disable Right Click Using jQuery in HTML Page
You can find many javascript code snippets to disable right-click. But jQuery makes our life easy. Below jQuery code disables the right click of the mouse.
<img src="picture.jpg" />$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});
We just need to bind the contextmenu event with the document element.
Method 2- To Disable Right Click Using jQuery in HTML Page
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
e.preventDefault();
});
});