2011-10-23 52 views
1

我想在用户粘贴时触发事件。有没有办法捕捉剪贴板粘贴事件w jQuery?

我有一个CONTENTEDITABLE股利和当用户粘贴我想要捕捉的事件,然后集中回CONTENTEDITABLE DIV在不默认执行的膏的结束。

想法?

感谢

+0

可能的[jQuery的捕捉糊输入(http://stackoverflow.com/questions/686995/jquery-catch-paste-input) –

回答

1

我不知道,如果这个工程跨浏览器,它的工作在Chrome:

$('body').bind('paste',function(){alert(1)}); 
+1

重复对于跨浏览器支持我发现特殊模式的文章:HTTP:// WWW。 quirksmode.org/dom/events/cutcopypaste.h TML – topek

1

您可以绑定到 '粘贴' 事件 -

jQuery(document).bind('paste', function(e){ alert('pasting!') })