Basic filter selector for jquery selector _ jquery

Source: Internet
Author: User
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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.