I am trying to add button to copy simple text string but without success.
You can't .select() a hidden element that has visibility: hidden; or display: none; but you can do something like this:
function kopiraj() {
var copyText = document.getElementById("toCopy");
copyText.select();
document.execCommand("Copy");
}
[aria-hidden="true"] {
opacity: 0;
position: absolute;
z-index: -9999;
pointer-events: none;
}