auto trigger zclip to copy without a button

196 views Asked by At

zclip is working when i click on the body but i am trying to make it copy to clipboard without clicking (on load)

$("#copy-button").click();

i think the problem is in $("#copy-button").zclip I am trying to make zclip copy a string when the doucment loads

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="./jquery.zclip.min.js"></script>

<script type="text/javascript">
    $(document).ready
    (function () {
        $("#copy-button").zclip({
            path: "http://codescratcher.com/download/ZeroClipboard.swf",
            copy: 'hello',
            beforeCopy: function () { },
            afterCopy: function () {
                //alert('Copy To Clipboard : \n' + $('#copy-button').val());
            }
        });
    });
    $("#copy-button").click();
</script>
 <body id="copy-button"><p>hey</p></body>

I've even tried

$(document).ready(zclip);
0

There are 0 answers