开发者

jQuery on copy into input [duplicate]

This question already has answers here: 开发者_如何学C Closed 10 years ago.

Possible Duplicate:

jQuery catch paste input

is there an event handler in jQuery for the event in which I paste a selection from the clipboard into an input field?

As for as I know there is no key movement involved so I would rule out keyup and keydown. Click event would probably react as soon as I click to active the input field but would not get the contents as they are pasted after that event.

Any input much appreciated.


Yes, you can use the 'paste' event. Here's an example, for copy, paste and cut for #textA

$("#textA").bind('copy', function() {
    alert('copy behaviour detected!')
}); 
$("#textA").bind('paste', function() {
    alert('paste behaviour detected!')
}); 
$("#textA").bind('cut', function() {
    alert('cut behaviour detected!')
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜