I was studying the code for the plugin below and wondering where and when does it tie the “Right Click” event. All it does is
Plugin reference link : http://www.javascripttoolbox.com/lib/contextmenu/
$(this).bind('contextmenu',function(e){cmenu.show(this,e);return false;});
and “contextmenu” is a custom jquery event type.
Can someone please explain how all this works
I did check there are click events but those are tied to the menu items and not the element to which the menu is tied.
Thanks
Answer: “contextmenu” is not a custom event type. It is actually another name (mapping etc) for ‘right click’
contextmenuis not a custom jQuery event (check out the MDC article on it here). All the plugin is doing is binding an event handler to this event and showing/hiding a menu.