This article mainly introduces the basic filter selector of jquery selector. If you need a friend, please refer to it and hope to help you.
The Code is as follows:
The Code is as follows:
Provincial/Municipal Administrative Divisions
Beijing |
Shanghai |
Shangqiu |
Haidian District |
Xuhui District |
Fuyang |
Chaoyang |
Zhabei District |
Liangyuan |
Changping |
Huangpu District |
Zhangye City |
I.: first
The Code is as follows:
$ ("Tr: first"). addClass ("highlight"); // obtain the first matching tr element.
Ii.: last ()
The Code is as follows:
$ ("Tr: last"). addClass ("highlight"); // obtain the last matching tr element.
3. not (selector)
The Code is as follows:
$ ("Td: not (: even)"). addClass ("highlight"); // get the td except that the index is an even number.
Iv. even
The Code is as follows:
$ ("Tr: even"). addClass ("highlight"); // matches all elements whose index values are even and starts counting from 0.
V. odd
The Code is as follows:
$ ("Tr: odd"). addClass ("highlight"); // matches all elements with odd index values and starts counting from 0.
Vi. eq (index)
The Code is as follows:
$ ("Tr: eq (2)"). addClass ("highlight"); // matches the element of a given index value
VII.: gt (index)
The Code is as follows:
$ ("Tr: gt (1)"). addClass ("highlight"); // match all elements greater than the given index value
8.: lt (index)
The Code is as follows:
$ ("Tr: lt (2)"). addClass ("highlight"); // match all elements smaller than the given index value
9. header
The Code is as follows:
$ (": Header"). addClass ("highlight"); // matches title elements such as h1, h2, and h3.