---
title: "Comment by jad inerky on \"💡 Easy Copy to Clipboard Button in Vanilla JavaScript\" | Hashnode"
description: "good post but I must suggest you mention that the document .execCommand ( &#x27;copy&#x27; ); is not a good solution, knowing that it might be removed at any ti"
url: "https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54/comment/5faed4d67fcc8d387fc0d33e"
---

[Discussion](https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54)

Comment [💡 Easy Copy to Clipboard Button in Vanilla JavaScript](https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54)

[jad inerky](https://hashnode.com/@jadinerky)

[Nov 13, 2020](https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54/comment/5faed4d67fcc8d387fc0d33e)

good post but I must suggest you mention that the

```
document.execCommand('copy');
```

is not a good solution, knowing that it might be removed at any time from any browser, [See Docs](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) and you can advise people to use a more stable and safe method as the [Clipboard API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard) still the best solution for me is to use them both, I can use the Clipboard API and the .execCommand() as a fallback

[Usman Sabuwala](https://hashnode.com/@usmanwrites)

[Nov 14, 2020](https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54/comment/5faed4d67fcc8d387fc0d33e#reply-5faf581e7fcc8d387fc0d778)

Thanks for the suggestion. I haven't used the Clipboard API yet but I am looking into it and I will write an updated version of this blog post using the Clipboard API. I chose `execCommand` as I think this is the easiest way possible to achieve the goal

[jad inerky](https://hashnode.com/@jadinerky)

[Nov 14, 2020](https://hashnode.com/posts/easy-copy-to-clipboard-button-in-vanilla-javascript/5fadfe62fa438d6532c7eb54/comment/5faed4d67fcc8d387fc0d33e#reply-5fafd49bab2abe435ce68e99)

[Usman Sabuwala](https://hashnode.com/@usman2102) you are right, it's the easiest way to do it.
