Context.js
Context.js copied to clipboard
Selecting element to which context menu is attached
Hi!
First off, this tool's really great, thanks a lot for releasing it. I've attached the context menu to a class of elements in my code, and I want to access the element from which the context menu was raised. Is there a clean way to do it? I'm looking for something like the following:
context.attach(".my-class", [
{text: 'Act on right-clicked element', action: function(e){
e.preventDefault();
// Is there a way to get a selector for the clicked item?
}}]
@chuyelchulo Presently, there is no way to do that. There is an issue for this.
Checkout this pull request which addresses this problem.
Thanks @najela, that's really useful. I think I should be able to patch it myself based on that pull request.