how to copy some text to the clipboard with jquery or javascript, from google. i know there
is a pludgin named zeroclipboard http://code.google.com/p/zeroclipboard/ can do this with
cross browers. the instructions link http://code.google.com/p/zeroclipboard/wiki/Instructions
but when i tested it on my site. i set it to copy text optionally . it can't work.
my test link is http://xanlz.com/copy/1.html
it always copys all the values. even i uncheck some check box. may be the value doesn't be changed. but when i alter()
the variable, the value is ok. how to correct it? thank you.
i want it can copy the checked box value. if the box unchecked, then don't copy its value.
EDIT :
Took me a while to figure this out (didn't have the correct references to the .swf), but here is a complete working example (tested IE 8 & Firefox 4)
ORIGINAL:
You don't have a click event for your button.
You need to add something like:
If you don't like to use (or are not allowed) to rely on flash (which I personally would not), I think you're better off creating a text area with the text (or serialized data) preselected with an instruction for the user to copy and later paste the data.
You can make the instruction feel more native by sniffing for the operating system and give different instructions on how to copy and paste (e.g. ctrl+c for windows/linux or ⌘-C for mac).
Maybe not as sexy, but way more foolproof...