I have a set of divs that are all dynamically generated. Within them are clipboard icons, that, when clicked, copy the element's data-hash to the clipboard (not yet functional). These icons have the class '.fa-clipboard' from FontAwesome.
Minimal code:
<script>
$(document).ready(function(){
var clip = new ZeroClipboard($('.fa-clipboard'), {
moviePath : 'plugins/ZeroClipboard.swf'
});
$(document).on('click', "#content .fa-clipboard", function(){
//alert(window.location + $(this).data('hash'));
clip.setText( window.location + $(this).data('hash') );
clip.glue( this );
});
});
</script>
<body>
<div id="wrapper">
<div id="content">
<!--Dynamically generated elements in here-->
</div>
</div>
</body>
</head>
</html>
The click function works properly, it's just a matter of setting the clipboard.