Execute Java Script from asp.net Repeater
===

I am trying to use to zeroclipboard library in the repeater. I have text box with data and a copy to clipboard button in every row of repeater. 


what I did is wrote a js function that takes the text box id and button and called it on button click while binding data to repeater from server. Here is the js method


    function copyToClipBoard(txtbox, btn, btnEvent) {
                if (btnEvent == 1) {
                    //create client
                    var clip = new ZeroClipboard.Client();

                    //event                    
                    clip.addEventListener('mousedown', function() {
                        clip.setText(document.getElementById(txtbox).value);
                    });
                    clip.addEventListener('complete', function(client, text) {
                        alert('copied: ' + text);
                    });

                    //glue it to the button
                    clip.glue(btn);
                    //document.getElementById(btn).click();

                }
            }

Now the problem is that when you click first time on any button, it calls the js functions and bind the zeroclipboard library to copy data to clipboard. and on second click on ward it start functioning normally (copying to clipboard)


I am unable to come up with any approach to implement the zeroclipboard with in repeater.Thanks for help in advance.