swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Dynamically (programmatically) populate context menu after right click event #681

Closed jochemstoel closed 5 years ago

jochemstoel commented 5 years ago

I keep getting stuck making the context menu decide the menu items on/immediately after the right click event. In all the examples the menu items are predefined for each selector. How would I go about implementing this properly?

bbrala commented 5 years ago

You should be able to do this with the following demo: https://swisnl.github.io/jQuery-contextMenu/demo/async-create.html

jochemstoel commented 5 years ago

There is a small error in this example you provided. It does not preventDefault() on right click. Chrome's native context menu opens too.