Select the text of a textarea automatically

Assume that ele represents a textarea element.

ele.addEventListener('focus', function(e) {
// Select the text
e.target.select();
});

More

Previous
Select the text content of an element
Next
Set css style for an element