How to select all text on focus in JavaScript?
The HTMLInputElement. select() method selects the entire text in a <textarea> element or <input> element that includes a text field. The HTMLElement. focus() method sets focus on the given element if it can be focused.
How to select all text input on focus in jQuery?
//Select all Input field on focus $("input"). select(); //Select Input field on focus whose type="text" $("input[type='text']"). select(); //Select input field using its id="input-field" $("#input-field"). select();