// 粘贴事件监控
$.fn.pasteEvents = function( delay ) {
if (delay == undefined) delay = 10;
return $(this).each(function() {
var $el = $(this);
$el.on("paste", function() {
$el.trigger("prepaste");
setTimeout(function() { $el.trigger("postpaste"); }, delay);
});
});
};
// 使用
$("input[type='text']").on("postpaste", function() {
// code...
}).pasteEvents();
04-27 17:43