Reputation: 2864
I'm using jQuery to create my own right-click context menu, but I'd like to maintain the system items such as Copy, Paste, Inspect Element, etc.
I know I can roll my own copy/paste functions, but how would I go about triggering the Dom Inspector/Inspect Element tool?
Any help is appreciated.
Upvotes: 1
Views: 135
Reputation: 2388
This is not possible with JavaScript.
You have two options that I can think of.
Don't use custom context menus
Allow the user to get back original functionality if they wish. For example by showing the original context menu if the shift key is pressed. Some browsers (Firefox) do this for you
:
$(document).on('contextmenu', function(event) {
if(event.shiftKey || event.ctrlKey) {
return;
}
event.preventDefault();
// Position and show my custom context menu element.
});
Upvotes: 0