function copyToClipboard(elementId) { /* Get the text field */ var copyText = document.getElementById(elementId); /* Select the text field */ copyText = copyText.textContent; /* Copy the text inside the text field */ navigator.clipboard.writeText(copyText); var tooltip = document.getElementById("myTooltip"); tooltip.innerHTML = "Copied"; } function resetCopy() { var tooltip = document.getElementById("myTooltip"); tooltip.innerHTML = "Copy to clipboard"; }