JavaScript Copy to Clipboard Without Flash and Libraries

You may also like...


  1. Alex says:

    cool script
    but how can I make it utilisable if I need several different elements to be copied in the same page??

    • The Web Flash says:

      You can use the copyToClipboard function in the last example. For instance:

      <button id="button1" onclick="copyToClipboard(document.querySelector('#element1'))" type="button">Copy</button>
      <button id="button2" onclick="copyToClipboard(document.querySelector('#element2'))" type="button">Copy</button>

Leave a Comment

Wrap your code block in [code] and [/code] tags.

This site uses Akismet to reduce spam. Learn how your comment data is processed.