O'Reilly logo

ASP.NET jQuery Cookbook by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Highlighting text in a TextBox and copying to the clipboard

In this recipe, we will see how to highlight text in a multiline TextBox control and copy to the clipboard.

Note

Due to the limitation of the jQuery clipboard plugin, this recipe is applicable to IE browsers only.

Getting ready

  1. Create a new web form Recipe4.aspx to the current project.
  2. Add a multiline TextBox with a hyperlink control to the form as shown below:
    <form id="form1" runat="server"> <div align="center"> <fieldset style="width:400px;height:300px;"> <p>Please enter your comments here:</p> <asp:TextBox ID="TextBox1" TextMode="MultiLine" Rows="5" Width="300" Height="200" runat="server"></asp:TextBox> <br /> <asp:HyperLink ID="lnkHighlight" Text="Click here to copy!" runat="server"></asp:HyperLink> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required