Tutorial Paste Events
$.fn.pasteEvents = function( delay ) {
if (delay == undefined) delay = 20;
return $(this).each(function() {
var $el = $(this);
$el.on("paste", function() {
$el.trigger("prepaste");
setTimeout(function() { $el.trigger("postpaste"); }, delay);
});
});
};
Call this plugin on an element, then you get callback events for before and after pasting:
$("#some-element").on("postpaste", function() {
// do something
}).pasteEvents();