Closed zhangxh1023 closed 3 years ago
I try to find a solution from source code.
And it seems to slove my problem.
$('#rebind').on('click', () => {
// remove bound events before rebind.
const selector = '.first';
for (const key in $.contextMenu.menus) {
if ($.contextMenu.menus[key].selector === selector) {
$(document).off('contextmenu' + key, selector, $.contextMenu.handle.contextmenu);
// delete $.contextMenu.menus[key]; // Maybe it can delete
}
}
// xxxxxxxx
But i don't know if it has any other problems.
I want to change the items callback, or remove the bound events and rebind it. But it doesn't work.
Can anyone help me? Thanks.