Auto Select All Content Within a Textarea Using Javascript

7/7/2014 2:54:02 PM

The following will highlight the text within a textarea upon clicking into the box.

<!-- jQuery is required. Remove the following line if you already are referencing jQuery -->
<script src="//"></script>

<textarea id="txtOutput" style="width: 500px; height: 300px; ">@this.Model.Output</textarea>

<script type="text/javascript">
		var $this = $(this);

		// Work around Chrome's little problem
		$this.mouseup(function ()
			// Prevent further mouseup intervention
			return false;