Detect paste text from clipboard

HTML
<div> <label for="email">Insert text from clipboard:</label> <input id="email"> </div> <div> <label for="debug">Text from <code>input</code>:</label> <span id="debug"></span> </div>
CSS
label { font-family: courier; }
JAVASCRIPT
$(function () { $(window).bind('paste', function (foo) { var clipboardData = foo.originalEvent.clipboardData; $('#debug').html(clipboardData.getData('text/plain')); }); });
Expand for more options Login