Home > Web Front-end > JS Tutorial > Detailed explanation of the basic filter selector of jquery selector_jquery

Detailed explanation of the basic filter selector of jquery selector_jquery

WBOY
Release: 2016-05-16 17:02:17
Original
1171 people have browsed it
Copy code The code is as follows:



Copy code The code is as follows:


Administrative divisions of provinces and cities



                                                                          Shanghai
🎜>                                                                        🎜>
                                                                               tr>
                                                                            gt;
                                                                             


Copy code


The code is as follows:


$("tr:first").addClass("highlight"); // Get the matching first tr element





2. :last()




Copy code

The code is as follows:

$("tr:last").addClass("highlight"); //Get the last matching tr element3. :not(selector)


Copy code

The code is as follows:

$("td:not(:even)").addClass("highlight");//Get td 4. :even


Copy code

The code is as follows:

$("tr:even").addClass("highlight"); //Match all elements with even index values, counting from 0five , :odd


Copy code

The code is as follows:


$("tr:odd"). addClass("highlight"); //Match all elements with odd index values, counting from 0
6. :eq(index)


Copy code

The code is as follows:


$("tr:eq(2)").addClass(" highlight"); //Match an element with a given index value



7. :gt(index)
Copy code The code is as follows:

$("tr:gt(1)").addClass("highlight"); //Match all elements greater than the given index value



8. :lt(index)
Copy code The code is as follows:

$("tr:lt(2)").addClass("highlight"); //Match all elements less than the given index value



9. :header
Copy code The code is as follows:

$(":header").addClass( "highlight"); //Match title elements such as h1, h2, h3

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template