zclip not working (No console errors)

168 Views Asked by At

this is my code. Dont know what wrong in it but not working.

<script>
$(document).ready(function() {
    $('#copy').click(function(e) {  
        alert("inn");
        $("#dynamic").zclip({
            path:'ZeroClipboard.swf',
            copy:$('input#dynamic').val(),
            afterCopy:function(){
                alert("immm");      
            }
        });
    });
});
</script>

HTML:

<input type="text" id="dynamic" value="abcd" />
<div id="copy">CLICK</div>
2

There are 2 best solutions below

1
Adrian Forsius On

This should suffice/work, since zclip has default click-event as eventhandler:

<script>
$(document).ready(function() {
    $("#copy").zclip({
        path:'ZeroClipboard.swf',
        copy: $('input#dynamic').val(),
        afterCopy:function(){
            alert("immm");      
        }
    });
});
</script>
0
Naveen1425 On

SOLVED: zclip only works on server. So you need to run it on localhost or server.