Use Javascript to copy Text from Label
- by Josh
Hello All-
Label1 (asp.net control) is located inside Panel1 of my webpage and I have a button called bt.  What is the Javascript to copy the Text from Label1 to the clipboard?
Thanks,
@ artlung, I placed the below code just outside of my form but inside the body.  The last line of code I placed inside Panel1 of my form.  Anything wrong with this code because nothing happens when I click the Copy to Clipboard button.
<script language="JavaScript"> 
                    var clip = new ZeroClipboard.Client(); 
                    clip.addEventListener( 'mouseDown', function(client) {  
                            // set text to copy here 
                            clip.setText( document.getElementById('form1.Label1').value ); 
                            // alert("mouse down");  
                    } ); 
                    clip.glue( 'd_clip_button' ); 
            </script> 
The next line of code is above the script tags but inside Panel1 in my form
<div id="d_clip_button">Copy To Clipboard</div>