Home > Web Front-end > JS Tutorial > body text

Jquery api cheat sheet sharing_jquery

WBOY
Release: 2016-05-16 16:21:01
Original
1080 people have browsed it

Selector

Match

*

All elements

#id

Element with given ID

element

All elements of a given type, say html tags

.class

All elements with a given class

a,b

Elements that match a or match b

a b

Elements matching b that are descendants of a (including grandchildren)

a > b

Elements that match b as a child element of a (only including children)

:first

The first element in the result set

:last

The last element in the result set

:not(a)

All elements in the result set that do not match a

:even

Even elements in the result set (counting from 0)

:odd

Odd elements in the result set (counting from 0)

:eq(index)

The element with index index in the result set (counting from 0)

:gt(index)

All elements in the result set after the given index (counting from 0)

:lt(index)

All elements in the result set before the given index (counting from 0)

:header

Heading element (

)

:animated

The element whose animation is playing

:contains(text)

An element containing the given text text

:empty

Elements that do not contain child nodes

:has(a)

At least one of the descendant elements matches a

:parent

The direct parent element of the current element

:hidden

Hidden elements, including hiding through css and

:visible

Opposite of the element matched by :hidden

[attr]

Element with attribute attr

[attr=value]

Elements whose attr attribute is value

[attr!=value]

Elements whose attr attribute is not value

[attr^=value]

Elements whose attr attribute value starts with value

[attr$=value]

Elements whose attr attribute value ends with value

[attr*=value]

The value of the attr attribute contains the string value

:nth-child(index)

Matches the index child element of each element in the collection (counting from 1)

:nth-child(even)

Matches the even-numbered child elements of each element in the set (counting from 1)

:nth-child(odd)

Matches the odd-numbered child elements of each element in the set (counting from 1)

:nth-child(formula)

Formula is a formula, the format is an b, a and b are integers

:first-child

Matches the first child element of each element in the collection

:last-child

Matches the last child element of each element in the set

:only-child

Matches the unique sub-element of each element in the collection. If it is not unique, it will not be executed

:input

All