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.
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.
No, you can't through JQuery/Javascript, but you can disable the whole context menu through Javascript:
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.