如何检测粘贴事件,如果它是由chrome上下文菜单触发的?如果使用ctrl + V完成
下面的代码工作正常。
$('#txtNumbers').on('keyup paste change', function () {
if ($(this).val() !== '') {
$('#btnAdd').prop('disabled', false);
}
else {
$('#btnAdd').prop('disabled', true);
}
});发布于 2016-09-07 18:13:45
使用input事件
$('#txtNumbers').on('input', function () {
if ($(this).val() !== '') {
$('#btnAdd').prop('disabled', false);
}
else {
$('#btnAdd').prop('disabled', true);
}
});https://stackoverflow.com/questions/39367074
复制相似问题