How to copy text to the clipboard using js?

There is such vsplyvala in which the button "copy". upon clicking it, the contents of the text field to the left should be copied to the clipboard.

4AkOXBpcMDEOkA.jpg

As it turned out, this is not an easy task. How to do it right? Support of browsers, such as IE7-10 - do not care.
July 9th 19 at 11:05
2 answers
July 9th 19 at 11:07
Solution
The first link in the search results https://clipboardjs.com/
Without libraries - guillermo_Nienow30 commented on July 9th 19 at 11:10
: Libraries somehow inside work without libraries, look in the source and all. One hell why rewrite from sorrow, if you can take already existing code - Claudia42 commented on July 9th 19 at 11:13
: No Flash. No dependencies. Just 3kb gzipped - Edwin.Abbo commented on July 9th 19 at 11:16
July 9th 19 at 11:09
Solution

Find more questions by tags JavaScript