How To Make OnClick Select All the Text from Textarea or Textbox Controls Using JavaScript in C# Asp.Net
Program:
.Aspx File:
Program:
.Aspx File:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>onclick select all textarea</title> <script type="text/javascript"> function SelectAll(id) { document.getElementById(id).focus(); document.getElementById(id).select(); } </script> </head> <body> <div> Enter Text:<br/> <input type="text" id="txtfld" onclick="SelectAll('txtfld');" style="width:200px" value = "This text you can select all" /><br /> Textarea:<br/> <textarea rows="5" cols="23" id="txtarea" onclick="SelectAll('txtarea');" style="width:200px" >Hi, Click hear </textarea> </div> </body> </html> |
Live Demo:
Enter Text:
Textarea: |
No comments:
Post a Comment