I want to copy some text to clipboard using javascript I have downloaded latest version of zeroClipboard 2.2
I have followed this example from http://davidwalsh.name/clipboard
Here is my html page:
$(document).ready(function(){
ZeroClipboard.setMoviePath("ZeroClipboard.swf");
//create client
var clip = new ZeroClipboard.Client();
//event
clip.addEventListener('mousedown',function() {
clip.setText(document.getElementById('box-content').value);
});
clip.addEventListener('complete',function(client,text) {
alert('copied: ' + text);
});
//glue it to the button
clip.glue('copy');
});
<html>
<meta http-equiv="Content-Type"/>
<head>
<script src="ZeroClipboard.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.3.min.js" ></script>
</head>
<body>
<textarea name="box-content" id="box-content" rows="5" cols="70">
The David Walsh Blog is the best blog around! MooTools FTW!
</textarea>
<br /><br />
<p><input type="button" id="copy" name="copy" value="Copy to Clipboard" /></p>
</body>
</html>
Thanls in advance.