1

i'm using a simple code to select all text inside textarea but i want the button to copy the text into the clipboard instead of using right click or Ctrl+c. here's the select code:

<form>
<textarea name='text_area' rows=1 cols=20 >large/<?php echo $row['Img_Name']; ?> 
</textarea> 
<input type='button' value='select path' onClick='javascript:this.form.text_area.focus(); this.form.text_area.select();'>
</form></div>

many websites add buttons to copy code or text just open this page and click share on the video and choose embed you'll get a copy button without the need to select the text or add the website to the white list http://techcrunch.com/2014/03/13/zuckerberg-called-obama-to-express-frustration-over-new-nsa-revelations/?source=gravity

jq beginner
  • 1,010
  • 3
  • 21
  • 41
  • This was discussed here: http://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript?rq=1 – SalkinD Mar 16 '14 at 11:29

1 Answers1

1

mozilla, like most other browsers doesn't let js manipulate the clipboard, unless the user set your website on a whitelist.

http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard

in response to your edited question: the video uses flash to copy to clipboard. There are several librarys that do so using hidden Flash content, for example ZeroClipboard

Matthias Schmidt
  • 585
  • 1
  • 7
  • 25