🆕 blog! “A simple "copy this code" button in JavaScript”
Next to all the code samples on this blog is a little "copy" button. That makes it easier to grab any of the code I've shared.
The HTML and JS is delightfully simple:
<button
onclick="navigator.clipboard.writeText(
this.parentNode.getElementsByTagName('code')[0].textContent
);"
…
👀 Read more: https://shkspr.mobi/blog/2026/08/a-simple-copy-this-code-button-in-javascript/
⸻
#HowTo #HTML #javascript