Copy Text to Clipboard Using Javascript

Опубликовано: 07 Январь 2018
на канале: Skptricks
612
0

post link : http://www.skptricks.com/2018/01/copy...

This post explains how to copy text to the clipboard with JavaScript. To copy text to clipboard here we are using document.execCommand("copy") method. Nowadays it is supported by most of browsers.

Browsers support :
To keep it simple, most of the modern browsers are supported, except Safari.
Chrome - 43.0.2356 or higher version
Firefox - 41.0 or higher version
Opera - 30 or higher version
IE - 9 or higher version
Safari is Not supported

Example :1 Copy text to clipboard from textarea
In this example we are copying the text from the textarea field to clipboard using javascript with help of copyToClipboard function.

Example :2 Copy text to clipboard from div tag
In this example we are copying the text from div tag to clipboad using javascript with help of copyToClipboard function.

post link : http://www.skptricks.com/2018/01/copy...