To focus on element there is an inbuilt selector available in jQuery, which is used to detect the currently focused element. When the element is get focused by the mouse click or by the tab-navigating button this selector return the selected element. You can add the element in JQuery to focused that element easily. Here we will use the JQuery inbuilt selector $(“:focus”)
Example 1: This example shows how to focus an element using jQuery.
- How to get focused a button automatically when the page load using HTML ?
- How to get relative click coordinates on the target element using JQuery?
- How to get N options from the <select> element using JQuery?
- How to get position of an element relative to the document or parent using jQuery ?
- How to get the outer html of an element using jQuery ?
- How to get all CSS styles associated with an element using jQuery ?
- Get the height of the hidden element in jQuery
- JQuery | Get the text of a span element
- JQuery | Get the n-th level parent of an element
- How to get the width of hidden element in jQuery ?
- How to get a DOM Element from a jQuery Selector ?
- How to remove parent element except its child element using jQuery ?
- How to get text of specific option tag using jQuery?
- How to get the size of screen, current web page and browser window using jQuery?
- How to get selected text from a drop-down list using jQuery?
- Get the current URL using jQuery?
- How to get all selected checkboxes in an array 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 email@example.com. 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.
Improved By : nidhi_biet