Skip to content Skip to sidebar Skip to footer

Is There An Event That Occurs After Paste?

Possible Duplicate: Detect pasted text with ctrl+v or right click -> paste I'm coding a js editor now. I want to do something (detect pasted text, etc.) just after the paste.

Solution 1:

Here's an example of handling paste event:

http://www.quirksmode.org/dom/events/tests/cutcopypaste.html

It's supported on many browsers but not 100% - see this table for compatibility: http://www.quirksmode.org/dom/events/cutcopypaste.html

You can also work around not having a paste event on some browsers by:

  • Remembering full contents of the form field at some time

  • Setting a timeout event

  • On timeout, take the contents of the field again, compare to the previous contents, and detect changes. Lather, rinse, repeat

Post a Comment for "Is There An Event That Occurs After Paste?"