0

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
baik
  • 993
  • 2
  • 14
  • 21
  • This has been asked and answered [here](http://stackoverflow.com/questions/686995/jquery-catch-paste-input) and [here](http://stackoverflow.com/questions/686995/jquery-catch-paste-input) – afranz409 Apr 29 '11 at 04:11

1 Answers1

7

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!')
});
Edgar Villegas Alvarado
  • 18,204
  • 2
  • 42
  • 61