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
Great answer by Intervalia.
Small improvement to it, sometimes the clicked element is not the one you want to copy.
So I suggest you pass the id of the element you want to copy.
Text Sample
And then, in the first line of your function do
element = document.getElementById(element);
Not much of a difference but I think it's more useful this way.