How can I make it so when you click inside a textarea, its entire content gets selected?
And eventually when you click again, to deselect it.
Slightly shorter jQuery version:
$('your-element').focus(function(e) { e.target.select(); jQuery(e.target).one('mouseup', function(e) { e.preventDefault(); }); });
It handles the Chrome corner case correctly. See http://jsfiddle.net/Ztyx/XMkwm/ for an example.