Question

I tried Zclipboard.js for copying the value but it didn't work.

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.steamdev.com/zclip/js/jquery.zclip.min.js"></script>
<script>
$(document).ready(function(){
    $('#copy-description').zclip({
        path:'ZeroClipboard.swf',
        copy:$('#description').text()

    });
});
</script>
<a id="copy-description" href="#" class="">Copy</a>
<p id="description">This should copy</p>

I referred it from this link. I am just getting a copy link with flash player embedded in it. But I cannot click it. What should I change in code, so that I can copy the description text on clicking copy link

Was it helpful?

Solution

I think the problem might be the swf file. Try this. Hope it works

$(document).ready(function(){
    $('#copy-description').zclip({
        path:'http://www.steamdev.com/zclip/js/ZeroClipboard.swf',
        copy:$('#description').text()

    });
});

OTHER TIPS

Make sure that the swf is loaded (using Firebug > Network) and that it is located above the link, as well with Firebug. Most likely the first one will solve your problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top