I'm trying to use contextmenu for the left menu button click but it's not working:
<input type="button" id="selector" value="click" />
jquery:
$('#selector').on('click',function(){
$(this).triggerHandler('contextmenu')
});
How should I implement?
Please check this is not working fiddle
Please note: I want to use default contextmenu on left click.
jsFiddle demo
You no need to trigger event, contextMenu can be shown manually.
Or use trigger option to handle left click.
JavaScript doesn't have the power to open the default browser context menu.
However, you can catch
contextmenu
event and triggercontextmenu
event on simple click:If you are using contextmenu plugin then you can simply use trigger: 'left' for left button click.
You can find plugin details and documentation from click here link