The select() event is applied to an element using jQuery when the user makes a text selection inside an element or on focus the element. This event is limited to some fields.
//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();
In below example, select all made on input element of the form using focus, focus and click event.
- JQuery | Set focus on a form input text field on page load
- How to find which DOM element has the focus using jQuery?
- jQuery | focus() with Examples
- jQuery | :focus Selector
- jQuery lose focus event
- How to select all elements without a given class using jQuery ?
- How to select all elements that contains some specific CSS property using jQuery ?
- How to select all visible or hidden elements in a HTML page using jQuery ?
- How to select text input fields using CSS selector ?
- How to Select Multiple Files using HTML Input Tag ?
- How to remove options from select element using jQuery ?
- How to select ID that starts with certain character using jQuery ?
- How to add options to a select element using jQuery?
- How to select first element in the drop-down list using jQuery ?
- How to fire an event on file select using jQuery ?
- How to select text nodes using jQuery ?
- How to select html element using ID in jQuery when ID contains a dot character ?
- How to get N options from the <select> element using JQuery?
- How to select a div with a certain class using jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.