This article mainly introduces the usage of the focus selector in jQuery and analyzes the functions, definitions, and usage skills of the focus selector in the form of examples. it has some reference value, for more information about how to use the focus selector in jQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:
This selector can match the elements that currently obtain the focus.
Syntax structure:
The code is as follows:
$ (": Focus ")
: The focus selector must be used with other selectors, such as class selector and element selector. For example:
The code is as follows:
$ ("Li: focus ")
The above code matches the li element that gets the focus.
Of course, no other selectors are added before this selector, but the specified selector is not added. by default, a general selector (*) is added (*). For example:
The code is as follows:
$ (": Focus ")
The above code is equivalent to the following code:
The code is as follows:
$ ("*: Focus ")
Instance code:
The code is as follows:
Foot home