I wish to produce a wordpress plugin which has a widget which includes a 'copy to clipboard' button copying a string towards the user's clipboard. Probably the most fundamental zeroclipboard functionality shows up on their page:

 <html>
    <body>
            <script type="text/javascript" src="ZeroClipboard.js"></script>

            <div id="d_clip_button" style="border:1px solid black; padding:20px;">Copy To Clipboard</div>

            <script language="JavaScript">
                    var clip = new ZeroClipboard.Client();
                    clip.setText( 'Copy me!' );
                    clip.glue( 'd_clip_button' );
            </script>
    </body>
    </html>

To convert this functionality right into a widget I attempted this (note: I'd no issues with setting up and signing up the wordpress plugin, this functionality):

 function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
?>

<?php
echo $before_widget;
?>

<?php
  if ($title) {
echo $before_title . $title . $after_title;
  }
?>

<div class="my_textbox">    
    <div id="d_clip_button" style="border:1px solid black; padding:20px;">Copy To Clipboard</div>       
</div>

 <?php
   echo $after_widget;
 ?>
 <?php

As you can tell all of the widget does is display the button div to copy. I did not know where you can add the javascript and so i place the enqueue script towards the top of the wordpress plugin.php file:

add_action('wp_head', 'wp_bitcoin_donations', 15);
wp_register_script( 'zeroclipboard', WP_PLUGIN_URL . '/bitcoin-donations-plugin/zeroclipboard.js' );
wp_enqueue_script( 'zeroclipboard' );

And also the relaxation within the widget initialisation section:

add_action( 'widgets_init', 'BitcoinDonationsWidgetInit' );
function BitcoinDonationsWidgetInit() {
  register_widget( 'BitcoinDonationsWidget' );
  ?>
  <script language="JavaScript">
    var clip = new ZeroClipboard.Client();
    clip.setText( 'Copy me!' );
    clip.glue( 'd_clip_button' );
  </script>
  <?php         
}
?>

The glue function doesn't appear to become working. Any ideas things i am doing wrong? Should i make use of the jquery on-page prepared to make certain my div is loaded before I run the glue function onto it? It may well be a trouble with this load order.