ZeroClipboard is a javascript + flash script that allows the browser to put text into the clipboard, it puts a transparent flash over the selected element , and when you click it you can insert text into the clipboard, this works, no problem, but i want to make it automatic. Onload put a string in the clipboard, for the user to be able to paste it latter. Some code main.js
$('document').ready(function() {
ZeroClipboard.setMoviePath("http://url/to/ZeroClipboard.swf");
var clip=new ZeroClipboard.Client();
clip.on( 'load', function(client) {
clip.glue('#redirlink');
} );
});
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<title>TEST</title>
</head>
<body>
<div >
<a id="redirlink" data-clipboard-text="abcd" href="http://alabala.com" >Click HERE</a>
</div>
</body>
</html>
ok now the question is how can i simulate a click event on the the zeroClipboard puts? i have tried with , $('#obkect_id").click();
it doesn't work (the event fires, but it has no effect on the clipboard, but when i click with the mouse, it works). Is there any way i can achieve that?