Vous êtes sur la page 1sur 1

jQuery 1.

4 Cheat Sheet

ImpulseStudios.ca

Core

Selectors

Effects

Events

Ajax

jQuery Function

Basic

Basics

Document Loading

Global Ajax Event Handlers

$(selector, context)
$(html, owner)
$(callback)

jQuery
jQuery
jQuery

No Conflict
jQuery

jQuery.noConflict(bool)

General Attributes
obj
jQuery
jQuery
jQuery
string
jQuery
string
jQuery
string, array
jQuery

.attr(attribute)
.attr(attribute, val)
.attr(attribute, fn)
.removeAttr(attribute)
.html()
.html(string)
.text()
.text(string)
.val()
.val(value)

CSS
Style Properties
string
jQuery

.css(property)
.css(property, val|fn)*

Class Attribute
jQuery
jQuery
bool
jQuery

.addClass(name|fn)*
.removeClass(name|fn)*
.hasClass(name)
.toggleClass(name|fn, switch)*

Dimensions
int
jQuery
int
jQuery
int
int
int
int

.height()
.height(val)
.width()
.width(val)
.innerHeight()
.innerWidth()
.outerHeight(margin)
.outerWidth(margin)

Offset
obj{top,left}
obj
obj{top,left}
int
jQuery
int
jQuery

jQuery.data(element, key, value)


jQuery.data(element, key)
.queue(queueName)
.queue(queueName, newQueue|cb)
.clearQueue(queueName)*
.dequeue(queueName)

jQuery
obj
array
jQuery
jQuery
jQuery

Miscellaneous
Collection Manipulation
.each(fn)

jQuery

Collection Manipulation
.get(index)
.index(selector|element)*
.size()
.toArray()*

.fadeIn(dur, cb)
.fadeOut(dur, cb)
.fadeTo(dur, opacity, cb)

parent > child


ancestor descendant
prev + next

element, array
num
num
array

prev ~ siblings

.slideUp(dur, cb)
.slideDown(dur, cb)
.slideToggle(dur, cb)

Attribute
[attribute|=val]
[attribute*=val]
[attribute~=val]
[attribute$=val]
[attribute=val]
[attribute!=val]
[attribute^=val]
[attribute]
[attribute1=val1] [attribute2=val2]

jQuery
jQuery
jQuery

Custom
.animate(prop, dur, easing, cb)
.animate(prop, options)
.delay(dur, queueName)*
jQuery.fx.off
.stop(clearQueue, jumpToEnd)

jQuery
jQuery
jQuery
bool
jQuery

Manipulation

Basic Filter

.clone(withDataAndElements)

jQuery

DOM Insertion, Around


.wrap(element|fn)*
.wrapAll(element)
.wrapInner(element|fn)*
.unwrap()*

jQuery
jQuery
jQuery
jQuery

DOM Insertion, Inside


.append(content|fn)*
.appendTo(target)
.prepend(content|fn)*
.prependTo(target)

:not(selector)

Content Filter
:contains(text)
:empty
:has(selector)
:parent

jQuery
jQuery
jQuery
jQuery

DOM Insertion, Outside


.after(content|fn)*
.before(content|fn)*
.insertAfter()
.insertBefore()

Visibility Filter
:hidden
:visible

jQuery
jQuery
jQuery
jQuery

DOM Removal
.detach(selector)*
.empty()
.remove(selector)

Child Filter
:first-child
:last-child
:nth-child(index/even/odd/eq)
:only-child

jQuery
jQuery
jQuery

DOM Replacement
.replaceAll()
.replaceWith(content|fn)*

Properties of the Global jQuery Object


obj
map
string

jQuery
jQuery
jQuery

Event Handler Attachment


.bind(type, data, fn)
.bind(events)*
.unbind(type, fn)
.unbind(event)*
.live(type, data, fn)*
.die(type, fn)
.one(type, data, fn)
jQuery.proxy(fn, scope)*
jQuery.proxy(scope, name)*
.trigger(type, params)
.triggerHandler(type, params)

jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
fn
fn
jQuery
obj

Browser Events
.error(fn)
.resize(fn)
.scroll(fn)

jQuery
jQuery
jQuery

.blur(fn)
.change(fn)
.focus(fn)
.select(fn)
.submit(fn)

jQuery
jQuery
jQuery
jQuery
jQuery

Keyboard Events
.focusin(fn)*
.focusout(fn)*
.keydown(fn)
.keypress(fn)
.keyup(fn)

jQuery
jQuery
jQuery
jQuery
jQuery

Mouse Events
.click(fn)
.dblclick(fn)
.hover(fn, fn)
.mousedown(fn)
.mouseenter(fn)
.mouseleave(fn)
.mousemove(fn)
.mouseout(fn)
.mouseover(fn)
.mouseup(fn)

jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery

Event Object
jQuery
jQuery

Utilities

:button
:checkbox
:checked
:disabled
:enabled
:file
:image
:input
:password
:radio
:reset
:selected
:submit
:text

.load(fn)
.ready(fn)
.unload(fn)

Form Events

Copying

:animated
:eq(index)
:even
:odd
:first
:last
:gt(index)
:header
:lt(index)

jQuery.support
jQuery.browser
jQuery.browser.version

jQuery
jQuery
jQuery

Sliding

Form

Data

jQuery
jQuery
jQuery
jQuery

Fading

Hierarchy

Attributes

.offset()
.offset(coordinates)*
.position()
.scrollLeft()
.scrollLeft(val)
.scrollTop()
.scrollLeft(val)

.hide(dur, cb)
.show(dur, cb)
.toggle(dur, cb)
.toggle(showOrHide)

*
#id
element
.class
selector, selectorN

jQuery.contains(container, contained)* bool


jQuery.each(obj, fn)
obj
jQuery.extend(deep, target, obj, objN) obj
jQuery.globalEval(code)
jQuery.grep(array, fn, invert)
array
jQuery.inArray(val, array)
num
jQuery.isArray(obj)
bool
jQuery.isEmptyObject(obj)*
bool
jQuery.isFunction()
bool
jQuery.isPlainObject(obj)*
bool
jQuery.isXMLDoc(node)
bool
jQuery.makeArray(obj)
array
jQuery.map(array, cb)
array
jQuery.merge(array1, array2)
array
jQuery.noop*
fn
jQuery.trim()
string
jQuery.unique(array)
array

event.currentTarget
element
event.data
anything
event.isDefaultPrevented()
bool
event.isImmediatePropagationStopped()bool
event.isPropagationStopped()
bool
event.pageX
num
event.pageY
num
event.preventDefault
event.relatedTarget
element
event.result
obj
event.stopImmediatePropagation()
event.target
element
event.timeStamp
num
event.type
string
event.which
string

.ajaxComplete(cb)
.ajaxError(cb)
.ajaxSend(cb)
.ajaxStart(cb)
.ajaxStop(cb)
.ajaxSuccess(cb)

jQuery
jQuery
jQuery
jQuery
jQuery
jQuery

Helper Functions
jQuery.param(obj, traditional)*
.serialize()
.serialzeArray()

string
string
array

Low-Level Interface
jQuery.ajax(settings)
jQuery.ajaxSetup(options)

XHR

Shorthand Methods
jQuery.get(url, data, cb, type)
jQuery.post(url, data, cb, type)
jQuery.getJSON(url, data, cb)
jQuery.getScript(url, cb)
.load(url, data, cb)

XHR
XHR
XHR
XHR
jQuery

Traversing
Tree Traversal
.children(selector)
.closest(selector, context)*
.closest(selectors, context)*
.find(selector)
.next(selector)
.nextAll(selector)
.nextUntil(selector)*
.offsetParent()
.parent(selector)
.parents(selector)
.parentsUntil(selector)*
.prev(selector)
.prevAll(selector)
.prevUntil(selector)*
.siblings(selector)

jQuery
jQuery
array
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery

Filtering
.eq(index)
.filter(selector)
.filter(fn)
.first()
.last()
.has(selector)*
.has(contained)*
.is(selector)
.map(cb)
.not(selector)
.not(elements)
.not(fn)

jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery

Miscellaneous Traversing
.add(selector)
.add(elements)
.add(html)
.add(selector, context)*
.andSelf()
.contents()
.end()

jQuery
jQuery
jQuery
jQuery
jQuery
jQuery
jQuery

Legend
light text
item|item
obj
bool
fn

optional parameter
or
object
boolean
function

cb
num
val
dur
*

callback
number
value
duration
new or updated in 1.4

Vous aimerez peut-être aussi