When a specific textarea is copied I want it to be hidden AFTER being copied. I have the following code:
$('#textarea20').on('copy', function() {
$('#textarea20').hide();
});
As you see this will hide it then the browser will try to copy a field that is hidden so it will copy nothing to the clipboard. Can you think of any way I can handle this? Any help is appreciated.
Deferring the hide()
by a few milliseconds should work.
Demo: http://jsfiddle.net/techfoobar/uxmRs/
Code:
$('textarea').on('copy', function() {
setTimeout(function() {
$('textarea').hide();
}, 10);
});