jQuery, disable right click browser menu

When working on complex applications with jQuery you get to a point where you need to have your own right click menu.

You have the options to disable entire page right click menu or just for a div.

Disable for the entire document:

  1. $(document).ready(function()
  2. {
  3.        $(document).bind("contextmenu",function(e){
  4.               return false;
  5.        });
  6. });

Disable for a div:

  1. $(document).ready(function()
  2. {
  3.        $(‘#my_div’).bind("contextmenu",function(e){
  4.               return false;
  5.        });
  6. });

Tags: , , ,

Comments are closed.