Hi I have a textarea with code text in it, and would like to have a link or button which when the user clicks on it, it will select ALL the code and copy it to the clipboard at the same time...
Can anyone help me?
I found this code which seems to work only in IE and it has something strange when I copy it to my HTML...link below...
Give this a try:
<textarea name="text_area" rows="10" cols="80">
blah blah blah blah blah blah blah
and to copy the text at the same when you click that button?
Firefox(Mozilla) doesn't allow this operation without enhanced privilages (editing prefs files, etc)...
MS is proprietry... window.clipboardData.setData(...) or document.execCommand('copy', false, null)
Opera/Safari... I'm not sure they support anything natively.
So you're best bet is flash... hope this helps.
When you click the "Highlight Text" button it will select everything in the <textarea>.
My fault sorry I thought that was all that was required.
If no one else has an idea how to do it...can you refer to the flash thing to do this?
I've not had to implement this technique yet myself (but there is a project I'm working on that will require this functionality), so all I can do at the mo is point you in a direction
Hope this helps.
This topic is now closed. New replies are no longer allowed.