Trigger Right-click
I am trying to late-bind context menus to elements, using the ContextMenu plugin. So on the first right-click on those elements, I would like to : intercept the right-click throu
Solution 1:
You can trigger it by
$('#element').trigger({
type: 'mousedown',
which: 3
});
Solution 2:
Solution 3:
Similar to this, but I'm not sure if you may be referring to jQuery UI data, but.
$('#element').mousedown(function(event)
{
if(event.which == 3)
{
if(typeof($(this).data('events')) === 'undefined')
{
$(this).data('events', { somedata: 'hello' });
}
else
{
// "re-throw" right click context menu
}
}
});
Post a Comment for "Trigger Right-click"