I am using the below code to copy content to clipboard. This is for asp.net core. But once a postback happens. this code is not working. What is the issue?
function copy() {
var txt = document.getElementById("result");
navigator.clipboard.writeText(txt.innerText);
}
Well, some browser doesn't support this
navigator.clipboard.writeText(), it's kinda like a Mozilla, I'll try make alternate this code for supporting most browsers. May help, if it is result of yours will be 'txt' only or copy text only. try this :