<div class="example">
  <p>
    <a href="https://www.raymondcamden.com">My blog</a><br />
    <a href="https://frontendmasters.com/blog/">Frontend Masters blog</a>
  </p>

  <textarea placeholder="Just a textarea to test pasting into"></textarea>

  <p>If this doesn't work for you <a href="https://codepen.io/pen/debug/bGPMEvN" target="_blank">try Debug Mode</a>.</p>
</div>
body {
  height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #455a64;
  font-family: monospace;
}

.example {
  background: white;
  border-radius: 12px;
  overflow: clip;
  width: 75dvi;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

textarea {
  height: 75px;
}

p {
  text-align: center;
  line-height: 2.5;
}
button {
  margin-inline: 0.5rem;
}
links = document.querySelectorAll("div.example p:first-child a");
links.forEach((a) => {
  let copy = document.createElement("button");
  copy.innerText = "Copy URL of Link";
  copy.addEventListener("click", async () => {
    console.log(a.href);
    await navigator.clipboard.writeText(a.href);
  });
  a.after(copy);
});
console.log(links);
/*
document.querySelector("#writeCB").addEventListener("click", async () => {
  await navigator.clipboard.writeText("Hello World!");
  console.log("Done!");
});
*/

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.