我在使用粘贴事件时有这行代码:
//This works
document.addEventListener('paste', e => {
console.log("e.clipboardData.getData('text/plain');",
e.clipboardData.getData('text/plain'));
});
但是我需要复制并粘贴一个按钮,所以:
//Not Working
jQuery(buttonId).click(e => {
console.log("e.clipboardData.getData('text/plain');",
e.clipboardData.getData('text/plain'));
});
答案 0 :(得分:-2)
Try this :
$("#buttonId").on("click",e => {
console.log("e.clipboardData.getData('text/plain');",
e.clipboardData.getData('text/plain'));
});
$ symbol is used instead of jQuery keyword , '#' is id selector in jQuery