Search code examples
javascriptjqueryzclip

copy string var to clipboard using zclip, javascript, jquery


How can I do that?

is it that simple I can't find how?

I'm doing this without success

function CopyStuff() {
    var textCopy = " text to copy \n is here}";
    zclip({
        path: "http://zeroclipboard.googlecode.com/svn-history/r10/trunk/ZeroClipboard.swf",
        copy: textCopy
    });
}

Solution

  • Zclip is it is a very useful tool but still quite buggy. Working with this plugin I have noticed that it is really unstable, it's functionality depends on how the DOM renders.

    Your main problem in your script is that you are not assigning any element in order to initialise and fire the copy event, usually this is a link or a button. Take a look on an example I made using a class and an ID of a div

    http://jsfiddle.net/XD6JM/