You are on page 1of 1

jQuery 1.

4 Cheat Sheet
Core
jQuery Function
$(selector, context) $(html, owner) $(callback) jQuery jQuery jQuery jQuery

ImpulseStudios.ca
Selectors
Basic
* #id element .class selector, selectorN

Effects
Basics
.hide(dur, cb) .show(dur, cb) .toggle(dur, cb) .toggle(showOrHide) jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery bool jQuery

Events
Document Loading
.load(fn) .ready(fn) .unload(fn) jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery fn fn jQuery obj jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery

Ajax
Global Ajax Event Handlers
.ajaxComplete(cb) .ajaxError(cb) .ajaxSend(cb) .ajaxStart(cb) .ajaxStop(cb) .ajaxSuccess(cb) jQuery jQuery jQuery jQuery jQuery jQuery string string array XHR

No Conflict
jQuery.noConflict(bool)

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)

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

Attributes
General Attributes
.attr(attribute) .attr(attribute, val) .attr(attribute, fn) .removeAttr(attribute) .html() .html(string) .text() .text(string) .val() .val(value) obj jQuery jQuery jQuery string jQuery string jQuery string, array jQuery

Hierarchy
parent > child ancestor descendant prev + next prev ~ siblings

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

Sliding
.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]

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

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

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

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

CSS
Style Properties
.css(property) .css(property, val|fn)* string jQuery jQuery jQuery bool jQuery int jQuery int jQuery int int int int obj{top,left} obj obj{top,left} int jQuery int jQuery jQuery obj array jQuery jQuery jQuery

Manipulation
Copying
.clone(withDataAndElements) jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery

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

Basic Filter
:animated :eq(index) :even :odd :first :last :gt(index) :header :lt(index) :not(selector)

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 jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery jQuery

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

DOM Insertion, Around


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

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

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

DOM Insertion, Inside


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

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

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

DOM Insertion, Outside


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

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

Visibility Filter
:hidden :visible

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

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

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

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

Event Object
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

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

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

Utilities
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

Miscellaneous Traversing
.add(selector) .add(elements) .add(html) .add(selector, context)* .andSelf() .contents() .end() cb num val dur *

Miscellaneous
Collection Manipulation
.each(fn) jQuery element, array num num array

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

Legend
light text item|item obj bool fn optional parameter or object boolean function callback number value duration new or updated in 1.4

Properties of the Global jQuery Object


jQuery.support jQuery.browser jQuery.browser.version obj map string

You might also like