Select all in textarea

DescriptionJavascript snippet by - 07/14/10

This code combination allows you to select all of the text in a texarea with the click of a button. It uses javascript to control the funtionality.

Tags

<script type="text/javascript">
function SelectAll(my_textarea)
{
document.getElementById("my_textarea").select()
}
</script>

<form name="select"> <textarea id="my_textarea" rows="6" cols="50"> Press Select Text to copy this text</textarea>

<input type="button" value="Select Text"onClick="SelectAll(my_textarea)">
  • Share
Submitted by: Adam J Nowak
http://hyperspatial.com

Comments and Feedback