How do I close a jquery contextMenu? -
i'm using a jquery contextmenu plug-in , have small issue i'm trying resolve.
currently when click 'delete' menu item function call prompts user confirmation box deletetests function. @ point contextmenu still visible , confirmation box.
ideally close contextmenu user selects menu item , proceed delete function.
this seems should trivial can't seem working.
$(document).ready(function(){ $.contextmenu({selector: '#context-menu', items: { "delete": {name: "delete", icon: "delete", callback: menu_click }, sep1: "---------", quit: {name: "quit", icon: "quit", callback: $.noop} }}); function menu_click(key, opt) { if (key == "delete") { // need close menu here deletetests(); } } });
you're right. should trivial, author did not provide functionality.
you can @ source , copy whatever author did when clicks outside of menu detected, hack.
you're in luck; i've done same thing plug-in myself.
the following do, remember it's hack:
$('.contextmenu').hide();
Comments
Post a Comment