I am working on a website project. For that I need to copy the text from the textbox to the clipboard so that it can be pasted into a notepad or somewhere else. I am using Visual studio 2008 with c#.
I have written this code but it's not working:
<script language="javascript" type="text/javascript">
function ClipBoard()
{
TextBox1.innerText = Button1.innerText;
Copied = TextBox1.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}
</script>
<asp:TextBox ID="TextBox1" runat="server">Click on the button to copy the this text</asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Copy Text" onclick="ClipBoard();" />
In this code 2 errors are occuring on the last line ")expected" and "invalid expresion term ')'"
Please help me if someone knows the solution for that.