[英]Firefox is not triggering paste event
I am creating application in which I need to bind paste
and other events to handle data in a textarea. 我创建的应用程序中需要绑定paste
和其他事件以处理文本区域中的数据。
I have 15 rows and 65 cols in my textarea. 我的文本区域中有15行和65个列。
I have created JSFiddle Demo . 我创建了JSFiddle Demo 。
To produce problem try to follow following steps: 要产生问题,请尝试执行以下步骤:
In first line console will display only one message. 在第一行控制台中将仅显示一条消息。 ( KeyDown
event) ( KeyDown
事件)
In second line console will display two message. 在第二行控制台将显示两个消息。 ( KeyDown
and paste
event) ( KeyDown
和paste
事件)
$('#myTextArea').on('keypress', function(event) {
console.log('not working');
});
$('#myTextArea').on('paste', function(event) {
event.preventDefault();
console.log("Event Fired... Hurray");
});
Please let me know is there any simple way to handle this paste event in all browser. 请让我知道,有没有一种简单的方法可以在所有浏览器中处理此粘贴事件。
您可能想要处理通用事件input
,无论字段如何向其中添加数据,都将触发该事件:
$("#myTextArea").on("input", ...);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.