DEV Community

loading...

Discussion on: How to copy text to the clipboard with JavaScript (5 lines of code)?

Collapse
lorenzosjb profile image
Lorenzo Jiménez • Edited

First, be sure that you review browser compatibility that you are supporting.
Also, one thing is getting data from the clipboard and putting it on it, that is very different to implement.

Collapse
ibrahima92 profile image
Ibrahima Ndaw Author

According to Can I Use 93.39% of browsers support this method.

And to paste something on the input field just do this document.execCommand("paste")