onclick copy button to copy text code example
Example: copy to clipboard button hide
<body>
<button onclick="setClipboard('test')">Ativar Conexão</button>
<script>
function setClipboard(value) {
var tempInput = document.createElement("input");
tempInput.style = "position: absolute; left: -1000px; top: -1000px";
tempInput.value = value;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
}
</script>