Jquery selector (original) & lt; 4 & gt;, jquery selector original

Source: Internet
Author: User

Jquery selector (original) <4>, original jquery Selector

I learned the basic selector. Now I want to learn the simple filter selector in the filter selector:

Simple filter selectors mainly filter elements based on index values. These filter selectors are similar to CSS pseudo-class selectors. They all start with a colon (:) and must be used with another selector.

1. The first selector filters the current jquery set and selects the first Matching Element. The syntax format is as follows:

$ ("Selector: first ")

The selector parameter indicates any valid selector.

2.: last Selector

: Last selector, which filters the current jquery set and selects the last matching element. The syntax format is as follows.

$ ("Selector: last ")

The selector parameter indicates any valid selector.

<! DOCTYPE html> 

3. odd Selector

: Odd selector, used to select all elements with an odd index (counting from 0). The syntax is as follows:

$ ("Selector: odd ")

The selector parameter indicates any valid selector. DOM elements, the index value in the jquery set starts from 0, so the index values of 2nd, 4th, and sixth are 1, 3, 5, and so on.

4.: enen Selector

: Even selector, used to select all elements with an even index (counted from 0). Syntax format:

$ ("Selector: even ")

The selector parameter indicates any valid selector. DOM elements, the index value in the jquery set starts from 0, so the index values of 1st, 3rd, and 5th are respectively 0, 2, 4, and so on.

<! DOCTYPE html> 

5.: eq () Selector

: The eq () selector is used to select the element whose index is equal to the given value from the matching set. The syntax format is as follows:

$ ("Selector: eq (index )")

The index starts from 0;

6. gt () Selector

: The gt () selector is used to select all elements whose indexes are greater than the given value from the matching set. The syntax format is as follows:

$ ("Selector: gt (index )")

The index starts from 0.

7.: lt () Selector

: Lt () selector is used to select all elements whose indexes are smaller than the given value from the matching set. The syntax format is as follows:

$ ("Selector: lt (" index ")")

The index starts from 0.

8.: not () Selector

: Not () selector, used to remove all elements that match the given selector from a matched set. Syntax format:

$ ("Selector1: not (selector2 )")

Eg: $ ("td: not (: first,: last )")

9.: header Selector

: Header selector, used to select all title elements such as h1, h2, and h3. Syntax format:

$ (": Header ")

Eg: $ (": header?#.css (" color "," red ");

10.: animated Selector

: The animated selector is used for all elements that are executing an animation. The syntax format is as follows:

$ ("Selector: animated ")

The selector indicates any valid selector.

 

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.