I have a function in my script that gives me an error. The function purpose is to copy text from static panel(not textbox or input) with onClick event.
Uncaught TypeError: copyText.select is not a function
The thing i want is to make the user able to click the text and it's get copied to his clipboard.
Maybe you can offer better function that works?
https://codepen.io/abooo/pen/jYMMMN?editors=1010
function myFunction() {
var copyText = document.getElementById("display");
copyText.select();
document.execCommand("Copy");
alert("Copied the text: " + copyText.value);
}
From w3schools
` doesn't have a `.value()` function (Nor does `
– Blue Dec 21 '17 at 19:51` have a `.select()` function). Perhaps you're thinking of an input?