Here is the configuration list of the content menu.
var option = { width: 150, items: [ { text: "Item One", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0126-16.gif", alias: "1-1", action: menuAction }, { text: "Item Two", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/ac0036-16.gif", alias: "1-2", action: menuAction }, //this is normal menu item, menuAction will be called if this item is clicked on { text: "Item Three", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/ei0021-16.gif", alias: "1-3", action: menuAction }, //this is a split line { type: "splitLine" }, //this is a parent item, which has some sub-menu items { text: "Group One", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0009-16.gif", alias: "1-4", type: "group", width: 170, items: [ { text: "Group Three", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0054-16.gif", alias: "2-2", type: "group", width: 190, items: [ { text: "Group3 Item One", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0062-16.gif", alias: "3-1", action: menuAction }, { text: "Group3 Item Tow", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0063-16.gif", alias: "3-2", action: menuAction } ] }, { text: "Group Two Item1", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0096-16.gif", alias: "2-1", action: menuAction }, { text: "Group Two Item1", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0111-16.gif", alias: "2-3", action: menuAction }, { text: "Group Two Item1", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0122-16.gif", alias: "2-4", action: menuAction } ] }, { type: "splitLine" }, { text: "Item Four", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0124-16.gif", alias: "1-5", action: menuAction }, { text: "Group Three", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0062-16.gif", alias: "1-6", type: "group", width: 180, items: [ { text: "Item One", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0096-16.gif", alias: "4-1", action: menuAction }, { text: "Item Two", icon: "/jquery-plugins-demo/wdContextMenu/sample-css/wi0122-16.gif", alias: "4-2", action: menuAction } ] } ] }; $("#target").contextmenu(option);
var option = { ... onShow: applyrule, } $("#target").contextmenu(option); function applyrule(menu) { menu.applyrule({ name: "target2", disable: true, items: ["1-2", "2-3", "2-4", "1-6"] }); }
//return false to stop menu to pop up function BeforeContextMenu() { return this.id != "target3"; }