I want to copy the text from function parameter, with other text after it
I tried making textarea element for only read and hide it,and put text in it but it didn't work
function Copy(str) {
const AllWord = str + "<br><br>Copied From HERE";
var el = document.createElement('textarea');
el.value = AllWord;
el.setAttribute('readonly', '');
el.style = {
position: 'absolute',
left: '-9999px'
};
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
}
Copy("CopiedText");
I expect it to copy "CopiedText"