/html-dom /Basic
GitHub 4932★

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

See also

Follow me on and to get more useful contents.