我想根据右键单击的DOM元素的ID创建动态菜单。这样我就可以显示特定用户的菜单,例如:“23号标签”
我正在使用像这样的上下文菜单
$.contextMenu({
selector: 'tr',
callback: function (key, options) {
var m = "clicked: " + key;
var temp = $(this);
if (key == "Rebate") DoInvoice();
},
items: {
"Credit Note": { name: "Credit Note " },
"Full Refund": { name: "Full Refund " },
"Partial Refund": { name: "Partial Refund " },
"Rebate": { name: "Rebate " }
}
});
目前我正在右键单击上下文菜单,如下图所示,
但我希望在格式中显示
"Credit Note For 130",
"Full Refund For 130",
"Partial Refund For 130",
"Rebate For 130"
请尽快帮助我。
答案 0 :(得分:0)
试试这个: -
var userid;
// Get the ID, when rightclick event is fired & set the ID to above variable.
items: {
"Credit Note For"+ userid : { name: "Credit Note " },
"Full Refund For"+ userid : { name: "Full Refund " },
"Partial Refund For"+ userid : { name: "Partial Refund " },
"Rebate For"+ userid : { name: "Rebate " }
}