.

Jquery 1.1.3 Cheat Sheet 2007-08-20 <http://www.JavascriptToolbox.com/jquery/>

.

CoreSelectors

.

$(html) / $(element) / $(selector [,context])$(func) / $(document).ready(func)E:nth-child(n) / E:first-child / E:last-child / E:only-child

.

each (func)$("img").each(function(i){E:emptyhas no children (including text nodes)

.

$()[i] o/$().get(i)this.src = "test" + i + ".jpg";E:enabledE:disabled

.

$().length / $().size()return false; // stop looping over eachE:checkedE:selected

.

});E#idE.className

.

AttributesE:not(s)does not match simple selector s

.

attr(name) / attr(name,val) / attr({name:val})attr(name, func)E FF element descendant of an E element

.

removeAttr(name)$("img").attr("title", function() { return this.src });E > FF element child of an E element

.

addClass(c) / removeClass(c) / toggleClass(c)E + FF element immediately preceded by an E element

.

html() / html(content)text() / text(content)E ~ FF element preceded by an E element

.

TraversingE[@foo]contains a "foo" attribute

.

add(expr) / add(html) / add(Element)Add more elements to the set of matched elementsE[@foo=bar]"foo" attribute value is exactly equal to "bar"

.

contains(text)Leave only elements that contain 'text'E[@foo^=bar]"foo" attribute value begins exactly with "bar"

.

filter(expr) / filter(func)Leave elements matching expr or func returning trueE[@foo$=bar]"foo" attribute value ends exactly with "bar"

.

find(expr)$("p").find("span") === $("p span")E[@foo*=bar]"foo" attribute value contains the substring "bar"

.

is(expr [,expr])returns booleanE[@foo!=bar]"foo" attribute is not equal to "bar"

.

next([expr])prev([expr])E[@foo~=bar]space-delimited "foo" attribute contains "bar"

.

not(expr) / not(Element)Removes matched elements from listE[@foo=bar][@baz=bop]Match multiple attributes

.

parent([expr]) / parents([expr])children([expr]):gt(N) / :lt(N):eq(0) and :nth(0)

.

siblings([expr])end():first / :last:even / :odd

.

DOM Manipulation:parentelements which have child elements (including text).

.

before(content) / after(content)Creates a new sibling before/after element:contains('test')elements which contain the specified text.

.

prepend(content) / append(content)Creates a new child node at the beginning/end:visible / :hidden

.

clone([deep])remove():inputAll form elements, not just type=input

.

empty()Removes all child nodes and content from EInput Type Selectors:

.

wrap(html)$("p").wrap("<div class='wrap'></div>");:password :radio :checkbox :submit :image :reset :button :file

.

CSSEffects

.

css(name)get val from first element in list onlySpeed Values:slow / normal / fast / #ms

.

css(key,val) / css( {key:val} )height() / height(val) / width() / width(val)animate(params, speed, easing, callback)

.

Events - return false from handlers to cancel default actionfadeIn/fadeOut(speed, callback)fadeTo(speed, opacity, callback)

.

bind(type,data,func) / unbind(type,func)function handler(event) {hide/show(speed, callback)slideDown/slideUp(speed, callback)

.

one(type, data, func) - execute only oncealert(event.data.foo);toggle()slideToggle(speed,callback)

.

hover(overfunc, outfunc)}AJAX

.

Event Types:$("p").bind("click", {foo: "bar"}, handler)$.ajax( properties )async: boolean

.

blur, change, click, dblclick, error, focus, keydown, keypress, keyup, load, mousedown, mousemove, mouseout, mouseover, mouseup, ready, resize, scroll, select, submit, unload$.ajaxSetup ( properties )beforeSend: func

.

$.get( url, properties, fn(data) )complete: func

.

toggle(evenfunc, oddfunc)$.getIfModified(url,props,fn(data) )contentType: string

.

trigger(type, data)Executes browser's default action also$.getJSON(url,props,fn(json) )data: {obj}/String

.

Misc$.getScript( url, callback )dataType: [xml,html,script,json]

.

$.browser.[safari, opera, msie, mozilla]$.browser.version$.post( url, props, fn(data) )error: func

.

$.each (obj, func)$.trim(str) - Trim a stringajaxComplete( fn(xhr,props) )global: boolean

.

$.each( [0,1,2], function(i, n){$.extend ( target, prop1, propN )ajaxError( fn(xhr,props) )ifModified: boolean

.

alert( "Item #" + i + ": " + n );var settings = { validate: false, limit: 5, name: "foo" };ajaxSend( fn(xhr,props) )processData:boolean

.

});var options = { validate: true, name: "bar" };ajaxStart( fn(xhr,props) )success: func

.

$.each( { name:"John",lang:"JS" },function(i,n){jQuery.extend(settings, options);ajaxStop( fn(xhr,props) )timeout: number

.

alert( "Name: " + i + ", Value: " + n );settings == { validate: true, limit: 5, name: "bar" }ajaxSuccess( fn(xhr,props) )type: [POST,GET]

.

});$.map (array, func)serialize()url: string

.

$.grep( array, func, invert)$.map( [0,1,2], function(n){load/loadIfModified( url, props, fn(responseText, status, response) )

.

$.grep( [0,1,2], function(n,i){return n + 4;$("#feeds").load("feeds.php",

.

return n > 0;});{limit: 25},

.

});$.merge (array, array) - removes dupesfunction() { alert("The last 25 entries in the feed have been loaded"); }

.

Result = [1, 2]$.merge( [0,1,2], [2,3,4] ) === [0,1,2,3,4]);

.