gpt4 book ai didi

javascript - 如果使用 chrome 中的上下文菜单粘贴,jquery 粘贴事件不会触发

转载 作者:行者123 更新时间:2023-11-30 11:51:21 24 4
gpt4 key购买 nike

如何检测粘贴事件,如果它是由 chrome 上下文菜单触发的?如果使用 ctrl + V

完成

以下工作正常。

 $('#txtNumbers').on('keyup paste change', function () {

if ($(this).val() !== '') {
$('#btnAdd').prop('disabled', false);
}
else {
$('#btnAdd').prop('disabled', true);
}
});

最佳答案

使用input事件

 $('#txtNumbers').on('input', function () {

if ($(this).val() !== '') {
$('#btnAdd').prop('disabled', false);
}
else {
$('#btnAdd').prop('disabled', true);
}
});

关于javascript - 如果使用 chrome 中的上下文菜单粘贴,jquery 粘贴事件不会触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39367074/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com