7

Can anyone tell me why this code is not working?

Link to zclip: http://www.steamdev.com/zclip/

Working example: http://jsfiddle.net/f4gZA/

Thanks in advance.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.steamdev.com/zclip/js/jquery.zclip.min.js"></script>
<script type="text/javascript" src="http://www.steamdev.com/zclip/js/jquery.snippet.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#copy-button").zclip({
    path: "http://www.steamdev.com/zclip/js/ZeroClipboard.swf",
    copy: function() {
        return $(this).prev().text();
    }
});

});
</script>

<div id='copy'>Test</div>
<button id='copy-button'>copy</button>
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
zack
  • 484
  • 3
  • 9
  • 25
  • This jsFiddle of your code works for me in Chrome: http://jsfiddle.net/jfriend00/pntm9/ so it doesn't look like there's anything wrong with the code you've presented here. More likely something different/wrong in your actual implementation or a problem with Flash on your local browser/system. – jfriend00 Jul 20 '11 at 03:32
  • jsFiddle works. this is the same code i added here. when i put this in a HTML file it dosent work. thats the problem – zack Jul 20 '11 at 03:34
  • Obviously there's something different about the web page environment that causes the problem. There's not much we can do here unless you give us some more clues about what is different or post a link to the actual web page that has the problem. – jfriend00 Jul 20 '11 at 04:34
  • 2
    I got it to work. problem comes when im using local host. when i uploaded to the sever it work. thanks – zack Jul 20 '11 at 04:44
  • 3
    Flash won't allow the copy operation when on local host unless you ease some permission in Flash. – jfriend00 Jul 20 '11 at 04:51

1 Answers1

1

I got it to work. problem comes when im using local host. when i uploaded to the sever it work. thanks

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265