[javascript] Selecting all text in HTML text input when clicked

You can always use document.execCommand (supported in all major browsers)

document.execCommand("selectall",null,false);

Selects all text in the currently focused element.