-1

How do you disable/remove the delete menu item in a context-menu when you right-click on a HTML input box?

I'm interested in any possibilities to do this for particular control with Jquery/Javascript.

Cilan
  • 13,101
  • 3
  • 34
  • 51
user478681
  • 8,330
  • 4
  • 26
  • 34

1 Answers1

1

No, you can't through JQuery/Javascript, but you can disable the whole context menu through Javascript:

Here is a fiddle

See How to add a custom right-click menu to a webpage?:

By singles:
Add a contextmenu event:

if (document.addEventListener) {
        document.addEventListener('contextmenu', function(e) {
            alert("You've tried to open context menu"); //here you draw your own menu
            e.preventDefault();
        }, false);
    } else {
        document.attachEvent('oncontextmenu', function() {
            alert("You've tried to open context menu");
            window.event.returnValue = false;
        });
    }

and even though you can't disable the delete context menu item, you can through CSS by telling the user to add:

#context-delete
{
    display:none;
}

to userChrome.css if they're using Chrome; see http://forums.mozillazine.org/viewtopic.php?t=30260

It is, however, unfortunate, that you cannot disable menu items individually.

Community
  • 1
  • 1
Cilan
  • 13,101
  • 3
  • 34
  • 51