jQUERY 1.4.2
VISUAL CHEAT SHEET
All Selector (“*”)
Selects all elements.
Class Selector (“.class”)
Matches all elements with the given name.
Element Selector (“element”)
Selects all elements with the given tag
name.
ID Selector (“#id”)
Selects a single element with the given id
attribute.
Multiple Selector (“selector1,
selector2, selectorN”)
Selects the combined results of all the
specified selectors.
❉ SELECTORS / 2. HIERARCHY
Child Selector (“parent > child”)
Selects all direct child elements specified
by "child" of elements specified by
"parent".
Descendant Selector (“ancestor
descendant”)
Selects all elements that are descendants
of a given ancestor.
Next Adjacent Selector (“prev +
next”)
Selects all next elements matching "next"
that are immediately preceded by a sibling
"prev".
Next Siblings Selector (“prev ~
siblings”)
Selects all sibling elements that follow
after the "prev" element, have the same
parent, and match the filtering "siblings"
selector.
❉ SELECTORS / 3. BASIC FILTER
:animated Selector
Select all elements that are in the progress
of an animation at the time the selector is
run.
:eq() Selector
Select the element at index n within the
matched set.
:even Selector
Selects even elements, zero-indexed
:first Selector
Selects the first matched element.
:gt() Selector
Select all elements at an index greater
than index within the matched set.
:header Selector
Selects all elements that are headers, like
h1, h2, h3 and so on.
:last Selector
Selects the last matched element.
:lt() Selector
Select all elements at an index less than
index within the matched set.
:not() Selector
Selects all elements that do not match the
given selector.
:odd Selector
Selects odd elements, zero-indexed. See
also even.
❉ SELECTORS / 4. CONTENT FILTER
:contains() Selector
Select all elements that contain the
specified text.
:empty Selector
Select all elements that have no children
(including text nodes).
:has() Selector
Selects elements which contain at least one
element that matches the specified
selector.
:parent Selector
Select all elements that are the parent of
another element, including text nodes.
❉ SELECTORS / 5. ATTRIBUTE
[name|=value]
Selects elements that have the specified
attribute with a value either equal to a
given string or starting with that string
followed by a hyphen (-).
[name*=value]
Selects elements that have the specified
attribute with a value containing the a
given substring.
[name~=value]
Selects elements that have the specified
attribute with a value containing a given
word, delimited by spaces.
[name$=value]
Selects elements that have the specified
attribute with a value ending exactly with
a given string.
[name=value]
Selects all elements that are headers, like
h1, h2, h3 and so on.
[name!=value]
Select elements that either don't have the
specified attribute, or do have the specified
attribute but not with a certain value.
[name^=value]
Selects elements that have the specified
attribute with a value beginning exactly
with a given string.
[name]
Selects elements that have the specified
attribute, with any value.
[name=value][name2=value2]
Matches elements that match all of the
specified attribute filters.
❉ SELECTORS / 6. CHILD FILTER
:first-child Selector
Selects all elements that are the first child
of their parent.
:last-child Selector
Selects all elements that are the last child of
their parent.
:nth-child Selector
Selects all elements that are the nth-child of
their parent.
:only-child Selector
Selects all elements that are the only child
of their parent.
❉ SELECTORS / 7. VISIBILITY FILTER
:hidden Selector
Selects all elements that are hidden.
:visible Selector
Selects all elements that are visible.
:button Selector
Selects all button elements and elements of
type button.
:checkbox Selector
Selects all elements of type checkbox.
:checked Selector
Matches all elements that are checked.
:disabled Selector
Selects all elements that are disabled.
:enabled Selector
Selects all elements that are enabled.
:file Selector
Selects all elements of type file.
:image Selector
Selects all elements of type image.
:input Selector
Selects all input, textarea, select and button
elements.
:password Selector
Selects all elements of type password.
:radio Selector
Selects all elements of type radio.
:reset Selector
Selects all elements of type reset.
:selected Selector
Selects all elements that are selected.
:submit Selector
Selects all elements of type submit.
:text Selector
Selects all elements of type text.
❉ CORE / 1. THE jQUERY FUNCTION
jQuery()
Accepts a string containing a CSS selector
which is then used to match a set of
elements.
❉ CORE / 2. OBJECT ACCESSORS
.context
The DOM node context originally passed to
jQuery(); if none was passed then context
will likely be the document.
.each( function(index, Element) )
Iterate over a jQuery object, executing a
function for each matched element.
.get( [ index ] )
Retrieve the DOM elements matched by the
jQuery object.
.index() ★
Search for a given element from among the
matched elements.
.length
The number of elements in the jQuery object.
.selector
A selector representing selector originally
passed to jQuery().
.size()
Return the number of DOM elements matched
by the jQuery object.
.toArray() ★
Retrieve all the DOM elements contained in the
jQuery set, as an array.
.queue( [ queueName ], newQueue)
Show the queue of functions to be executed on
the matched elements.
.data( obj ) ★
Store arbitrary data associated with the
matched elements.
.removeData( [ name ] )
Remove a previously-stored piece of data.
.dequeue( [ queueName ] )
Execute the next function on the queue for the
matched elements.
jQuery.fn.extend( object )
Extends the jQuery element set to provide new
methods (used to make a typical jQuery
plugin).
jQuery.extend( object )
Extends the jQuery object itself.
❉ CORE / 5. INTEROPERABILITY
jQuery.noConflict( )
Relinquish jQuery's control of the $ variable.
jQuery.noConflict(extreme)
Extends the jQuery object itself. This is to be
used in an extreme case where you’d like to
embed jQuery into a high-conflict environment.
SELECTORS ✼ CORE ✼ ATTRIBUTES ✼ CSS ✼ TRAVERSING ✼ MANIPULATION ✼ EVENTS ✼ EFFECTS ✼ AJAX ✼ UTILITIES
★ = NEW IN jQUERY 1.4.x / ❉ = DEPRECATED / a = ARRAY / jQ = jQUERY / El = ELEMENT / 0-1 = BOOLEAN / Obj = OBJECT / NUM = NUMBER / Str = STRING
评论0
最新资源