jQuery on copy into input [duplicate]
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!')
});
精彩评论