0

I want to enable the paste option of the context menu (right click menu) when someone right clicks in a div. It seems that it only appears in inputs and textareas, but the "paste" event is global. I need people to right click a div and have the paste option in their menus.

Can it be done?

lourfp
  • 1
  • 1
  • Welcome to SO. Short answer - Yes; however this is not a free code service. Please provide examples of what you have tried, what happened vs expected, etc, etc. – ggdx May 23 '19 at 14:52

1 Answers1

0

What you want to achieve is no longer supported: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contextmenu

But, you can build your own contextmenu. For that, you have a great example here: How to add a custom right-click menu to a webpage? based on oncontextmenu javascript event: https://www.w3schools.com/jsref/event_oncontextmenu.asp

As always, there's a library for everything, maybe you'd like to try this one: http://ignitersworld.com/lab/contextMenu.html (I've never used it, first result on Google)

seergiue
  • 326
  • 1
  • 3
  • 15
  • 1
    I know that i can create a js contextmenu, i've done it lots of times, but then i'd have to be able to trigger the "paste" or "Ctrl+v" event programatically, and it can't be done. If it's possible then tell me how because i wouldn't need the context menu in the first place :D – lourfp May 23 '19 at 21:06