Highlighting text in a TextBox and Copying to the Clipboard using JavaScript

Leave a Comment
Highlighting text in a TextBox and Copying to the Clipboard using JavaScript.

Just Use Below Code -

<textarea rows="10" cols="30" onclick="this.focus();this.select()" readonly="readonly">
Run the web page. Enter some text in the multiline TextBox field and click the hyperlink. The
text will be highlighted as shown below.
</textarea>

Use Below code in Asp.Net using TextBox Control -
<asp:TextBox ID="TextBox1" Width="150" Height="100" onclick="this.focus();this.select()" ReadOnly="true" TextMode="MultiLine" runat="server">
Run the web page. Enter some text in the multiline TextBox field and click the hyperlink. The
text will be highlighted as shown below.
</asp:TextBox>

Demo

0 comments:

Post a Comment