2

I have a textbox with an 'Add to clipboard' button next to it. Whenever the copy to clipboard button is pressed, I want the contents of the clipboard to get copied to the clipboard, and work in a cross browser way across Internet Explorer, Firefox, Chrome, Opera, etc. I can use jQuery or plain JavaScript.

How can this be done?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ali
  • 261,656
  • 265
  • 575
  • 769

1 Answers1

2

Sounds like the jQuery clipboard plugin might do the job well. You can use the selector notation with it too, ot the utility $.copy

EDIT:

ZeroClipboard is another choice and this does appear to work well (tested in Firefox 3.5, IE 6 and Chrome)

Russ Cam
  • 124,184
  • 33
  • 204
  • 266
  • 1
    The jQuery one seems not to have been updated to cope with the new security model in Flash 10 (following a load of annoying clipboard-corrupting attacks). You pretty much have to let the Flash interface take the click now before you can set clipboard; that's what ZeroClipboard does. – bobince Sep 08 '09 at 00:23