This article mainly introduces the usage of the lt selector in jQuery. The example analyzes the functions, definitions, and matching skills of the lt selector that are less than the specified index value, which has some reference value, for more information about jQuery, see the following example: lt selector usage. Share it with you for your reference. The specific analysis is as follows:
This selector matches all elements smaller than the given index value.
The minimum index value starts from 0.
Syntax structure:
The Code is as follows:
$ (": Lt (index )")
This selector should also be used with other selectors, such as class selector and element selector.
For example:
The Code is as follows:
$ ("Li: lt (3)" ).css ("color", "blue ")
The above Code sets the font color of the li element with the index less than 3 to blue.
If it is not used with other selectors, the default state is to use with the * selector. For example, $ (": lt") is equivalent to $ ("*: lt ").
Parameter List:
Parameters |
Description |
Index |
The specified index value. |
Instance code:
Instance 1:
The Code is as follows:
Foot home