N
N
Nikolay2014-09-14 23:47:28
JavaScript
Nikolay, 2014-09-14 23:47:28

How to copy text from variable to google chrome clipboard?

I after a number of manipulations with lines receive the text in a variable. I need to copy and paste it into a browser popup window. How do I copy text from a variable to the clipboard?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Skogorev, 2014-09-14
@EnterSandman

using flash - google to the rescue
How to copy the address of the image by clicking on the element? - here they discussed the impossibility without a flash drive

A
Andrey Ezhgurov, 2014-09-15
@eandr_67

Press F12 - the developer panel will open. There, go to the Console tab (js-console).
Enter the command console.log( variable name );
The displayed contents of the variable are selected with the mouse and copied to the clipboard in the standard way (Ctrl + C, or from the menu by the right mouse button).
Even better - directly in the js code, insert the command console.log( variable name ); - then the contents of the variable will be automatically displayed in the above console.
If you need to programmatically work with the clipboard, then you can install, for example, the jQuery zClip plugin: habrahabr.ru/post/159879

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question