Skip to content

Commit

Permalink
Fix: clipboard button not working
Browse files Browse the repository at this point in the history
Resolved issue with non-functional clipboard button on homepage.
  • Loading branch information
HelllGuest committed Dec 27, 2023
1 parent f2f936d commit f128962
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,18 @@
</div>
</div>
</footer>

<!-- JavaScript code -->
<script>
document.getElementById('copy-button').addEventListener('click', () => {
const curl = document.getElementById('curl');
const range = document.createRange();
range.selectNodeContents(curl);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand('copy');
});
</script>

</body>
</html>

0 comments on commit f128962

Please sign in to comment.