Skip to content

Instantly share code, notes, and snippets.

@ruswerner
Created December 27, 2013 02:10
Show Gist options
  • Save ruswerner/8141539 to your computer and use it in GitHub Desktop.
Save ruswerner/8141539 to your computer and use it in GitHub Desktop.
Javascript Clipboard Paste
if(event.metaKey && event.keyCode == 86 /* V */) {
var txt = $('<textarea></textarea>');
$('body').append(txt);
txt.on('paste',function(e){
console.log(e.originalEvent.clipboardData.getData('text/plain'));
txt.remove();
}).focus();
return;
}
@ruswerner
Copy link
Author

Put this code into:

$('window').bind('keydown',function() { ... });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment