0

Good day.

We have code:

<div id="test" style="display:none">text for test copy</div>
<button id="button">copy</button>

For get text in div we use jquery:

$("#button").on("click",function(){
 var text = $("#test").html();
 alert(text);
});

But i dont know how copy text to clipboard...

Tell me please how copy text (on jquery code it will be text) to clipboard ?

P.S.: preferably without flash.

  • **[Clipboard Plugin](http://www.sitepoint.com/jquery-copy-clipboard-4-options/#.UFbo1YriYz0)**. Search for more on google. – Shaunak D Jun 02 '14 at 05:07
  • http://stackoverflow.com/questions/7218061/javascript-copy-text-to-clipboard as well – Wilf Jun 02 '14 at 05:08
  • refer this link: http://www.steamdev.com/zclip/ – gulshanm01 Jun 02 '14 at 05:18
  • @shaunakde i know it, if i understand this plugin work with flash, i would like work without flash, only on jquery, becouse not all platforms use flash(for example in iphone flash not work) –  Jun 02 '14 at 05:18
  • It is possible in IE without `flash` for all others you'll need `flash`. Possibly only one great thing in IE :). – Vedant Terkar Jun 02 '14 at 05:19
  • @VedantTerkar very bad(- –  Jun 02 '14 at 05:50

1 Answers1

0

In IE the browser provide default object to work with clipboard. You can find the more information regarding how to use window.clipBoardData in the below link.

window.clipBoardData

In FireFox they have interface component to do this. Please refer the below link.

Using the Clipboard in Firefox

Madhu
  • 2,416
  • 3
  • 15
  • 33