$.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); )); )); );
Helistage sellele pistikprogrammile elemendis, seejärel saate enne ja pärast kleepimist tagasihelistamise sündmusi:
$("#some-element").on("postpaste", function() ( // do something )).pasteEvents();