I am trying to copy value of a variable to clipboard which is coming from ajax response. I have searched about it and find lot of threads, but issue is everyone asking to use input
for value selection using JavaScript select()
function. Following script I am trying which does not works,
success:function(data)
{
var copyText = data.geturl;
document.execCommand("copy");
alert("Copied the text: " + copyText);
return false;
}
Can someone kindly guide me that is there any way to copy value of variable to clipboard without using input
? I would like to appreciate.
Thank you so much.