I have a code like this below, but when I want to copy the selected text from textarea by using document.execCommand("copy");
it doesn't copy to clipboard
I search a lot and none of found solutions worked for me
How can I copy the selected text?
Sample Code:
data.forEach(function( single ) {
result += '^' + fontSize + ' ' + single.sno + '\n';
});
var $temp = $("<textarea></textarea>");
$("body").append($temp);
$temp.val(result+"").select();
document.execCommand("copy");
$temp.remove();
alert('copied');