82/97

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();
});

Might be useful