0% found this document useful (0 votes)
401 views1 page

jQuery 1.4 API Cheat Sheet

This document provides a cheat sheet summary of jQuery selectors, core functions, traversing, events, AJAX, and other APIs. It lists the main categories of jQuery functionality and provides brief descriptions and examples of common functions within each category, such as selectors for selecting elements by id, class, and other attributes, and core functions for creating jQuery objects and accessing properties. It also summarizes functions for traversing the DOM, binding and triggering events, performing asynchronous requests, and other utilities.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
401 views1 page

jQuery 1.4 API Cheat Sheet

This document provides a cheat sheet summary of jQuery selectors, core functions, traversing, events, AJAX, and other APIs. It lists the main categories of jQuery functionality and provides brief descriptions and examples of common functions within each category, such as selectors for selecting elements by id, class, and other attributes, and core functions for creating jQuery objects and accessing properties. It also summarizes functions for traversing the DOM, binding and triggering events, performing asynchronous requests, and other utilities.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

jQuery 1.

4 API Cheat Sheet


Selectors Core Traversing Events AJAX
Basics Hierarchy jQuery function Filtering Page Load Low-Level Interface
#id ancestor $ .jQuery( selector [, context] ), $ .eq( index ) $ .ready( fn() ) XHR [Link]( options )
element descendant .jQuery( element ), .jQuery( elementArray ), $ .first( ) 1.4+ Event Handling bool async = true fn beforeSend( XHR )
.class, parent > child .jQuery( jQueryObject ), .jQuery( ) 1.4∗ $ .last( ) 1.4+ bool cache = true fn complete(XHR, status)
$ .bind( type [, data ], fn(eventObj) )
.[Link] prev + next $ .jQuery( html [, ownerDocument] ), $ .has( selector ), str contentType obj context
* prev ~ siblings .jQuery( html, props ) 1.4∗
$ .one( type [, data ], fn(eventObj) )
.has( element ) 1.4+ obj, str data fn dataFilter( data, type )
selector1, $ .jQuery( fn ) $ .trigger( event [, data])
$ .filter( selector ), .filter( fn(index) ) bool global = true bool ifModified = false
selector2 obj .triggerHandler( event [, data]) str jsonp fn jsonpCallback
jQuery Object Accessors bool .is( selector ) $ .unbind( [type] [, fn]) str password bool processData = true
Basic Filters Content Filters $ .each( fn(index, element) ) $ .map( fn(index, element) ) num timeout str type = 'GET'
num .size( ), .length $ .not( selector ), .not( elements ), Live Events str url = curr. page str username
:first :contains(text)
.not( fn( index ) ) $ .live( eventType [, data], fn() ) fn xhr str scriptCharset
:last :empty [Link]
[Link] $ .slice( start [, end] ) $ .die( [eventType] [, fn() ]) str dataType ∈ {xml, json, script, html}
:not(selector) :has(selector)
$ .eq( index ) Interaction Helpers fn error( XHR, status, errorThrown )
:even :parent Tree traversal fn success( data, status, XHR )
:odd [el],[Link]( [index] ) $ .children( [selector] ) $ .hover( fnIn(eventObj), fnOut(eventObj))
:eq(index) Visibility Filters [Link]( options )
num .index( ) 1.4∗, .index( selector ) 1.4∗, $ .closest( selector [, context] ) 1.4∗ $ .toggle( fn(eventObj), fn2(eventObj) [, ...])
:gt(index) :hidden .index( element ) Shorthand Methods
:visible
arr .closest( selectors [, context] ) 1.4+ Event Helpers
:lt(index) arr .toArray( ) 1.4+ $ .load( url [, data] [, fn( responseText, status, XHR )] )
$ .find( selector ) $ .blur( [fn] ), .mousedown( [fn] ),
:header XHR [Link]( url [, data] [, fn( data, status, XHR )] [, type] )
Interoperability $ .next( [selector] ) .change( [fn] ), .mouseenter( [fn] ),
:animated XHR [Link]( url [, data] [, fn( data, status )] )
$ [Link]( [extreme] ) $ .nextAll( [selector] ) .click( [fn] ), .mouseleave( [fn] ),
XHR [Link]( url [, fn( data, status )] )
Child Filters Attribute Filters $ .nextUntil( [selector] ) 1.4+ .dblclick( [fn] ), .mousemove( [fn] ),
XHR [Link]( url [, data] [, fn( data, status )] [, type] )
:nth-child(expr) [attribute] Attributes $ .offsetParent( ) .error( [fn] ), .mouseout( [fn] ),
:first-child [attribute=value] Attributes $ .parent( [selector] ) .focus( [fn] ), .mouseover( [fn] ), Global Ajax Event Handlers
:last-child [attribute!=value] str .attr( name ) $ .parents( [selector] ) .focusin( [fn] ), 1.4+ .mouseup( [fn] ), $ .ajaxComplete( fn( event, XHR, options ) )
:only-child [attribute^=value] $ .attr( name, val ), .attr( map ), $ .parentsUntil( [selector] ) 1.4+ .focusout( [fn] ), 1.4+.resize( [fn] ), $ .ajaxError( fn( event, XHR, options, thrownError ) )
[attribute$=value] .attr( name, fn(index, attr) ) $ .prev( [selector] ) .keydown( [fn] ), .scroll( [fn] ), $ .ajaxSend( fn( event, XHR, options ) )
[attribute*=value] $ .removeAttr( name ) $ .prevAll( [selector] ) .keypress( [fn] ), .select( [fn] ), $ .ajaxStart( fn( ) )
[attribute|=value] $ .prevUntil( [selector] ) 1.4+ .keyup( [fn] ), .submit( [fn] ), $ .ajaxStop( fn( ) )
[attribute~=value] Class
$ .addClass( class ), $ .siblings( [selector] ) .load( fn ), .unload( fn ) $ .ajaxSuccess( fn(event, XHR, options) )
[attribute]
[attribute2] .addClass( fn(index, class) ) 1.4∗ Miscellaneous Event object Miscellaneous
bool .hasClass( class ) $ .add( selector [, context] ), event
={ str .serialize( )
Forms Form Filters $ .removeClass( [class] ), .add( elements ), .add( html ) 1.4∗ currentTarget,
el [obj] .serializeArray( )
:input :enabled .removeClass( fn(index, class) ) 1.4∗ $ .andSelf( ) data,
* str [Link]( obj, [traditional] ) 1.4∗
:text :disabled $ .toggleClass( class [, switch] ), $ .contents( ) isDefaultPrevented(),
bool
:password :checked isImmediatePropagationStopped(),
bool
:radio :selected
.toggleClass( fn(index, class) [, switch] ) 1.4∗ $ .end( )
isPropagationStopped(),
bool Utilities
HTML, text pageX,
num Browser and Feature Detection
:checkbox
:submit
str .html( ) Manipulation pageY,
num obj [Link]
$ .html( val ), .html( fn(index, html) ) 1.4∗ Inserting Inside preventDefault(), obj [Link] deprecated
:image el relatedTarget,
:reset str .text( ) $ .append( content ), str [Link] deprecated
$ .text( val ), .text( fn(index, html) ) 1.4∗ obj result, bool [Link] deprecated
:button .append( fn( index, html ) ) 1.4∗ stopImmediatePropagation(),
:file Value $ .appendTo( target ) stopPropagation(), Basic operations
str,arr .val( ) $ .prepend( content ), el target, obj [Link]( obj, fn( index, valueOfElement ) )
$ .val( val ), .val( fn() ) 1.4∗ .prepend( fn( index, html ) ) 1.4∗ num timeStamp, obj [Link]( [deep,] target, obj1 [, objN] )
Legend $ .prependTo( target ) str type,
str which arr [Link]( array, fn( element, index ) [, invert] )

Conventional signs
CSS Inserting Outside } arr [Link]( obj )
CSS $ .after( content ), .after( fn() ) 1.4∗ arr [Link]( array, fn( element, index ) )
[obj] — array of objects
1.4+ — new in 1.4
str .css( name ) $ .before( content ),
.before( fn() ) 1.4∗
Effects num [Link]( val, array )
arr [Link]( first, second )
$ .css( name, val ), .css( map ), Basics
1.4∗ — changed in 1.4 .css( name, fn(index, val) ) 1.4∗ $ .insertAfter( target ) fn [Link] 1.4+
$ .show( [ duration [, fn] ] )
$ .insertBefore( target ) fn [Link]( fn, scope ), [Link]( scope, name ) 1.4+
Positioning $ .hide( [ duration [, fn] ] )
Data types obj .offset( ) Inserting Around $ .toggle( [showOrHide] ) arr [Link]( array )
* — anything $ .offset( coord ), $ .unwrap( ) 1.4+ $ .toggle( duration [, fn] ) str [Link]( str )
$ — jQuery object .offset( fn( index, coord ) ) 1.4+ $ .wrap( wrappingElement ), Data functions
.wrap( fn ) 1.4∗ Sliding
arr — array $ .offsetParent( ) $ .clearQueue( [name] ) 1.4+
$ .wrapAll(wrappingElement ), $ .slideDown( duration [, fn] )
bool — boolean obj .position( ) $ .dequeue( [name] ), [Link]( [name] )
.wrapAll( fn ) 1.4∗ $ .slideUp( duration [, fn] )
int .scrollTop( ) obj [Link]( element, key ), [Link]( ) 1.4+
el — DOM element $ .wrapInner( wrappingElement ), $ .slideToggle( [duration] [, fn] )
$ .scrollTop( val ) obj .data( ), .data( key )
fn — function .wrapInner( fn ) 1.4∗ Fading
int .scrollLeft( ) $ .data( key, val ), .data( obj ) 1.4∗
int — integer $ .scrollLeft( val ) Replacing $ .fadeIn( duration [, fn] )
$ .removeData( [name] )
obj — object $ .replaceWith( content ), $ .fadeOut( duration [, fn] )
Height and Width [fn] .queue( [name] ) [Link]( [name] )
str — string .replaceWith( fn ) 1.4∗ $ .fadeTo( duration, opacity [, fn] )
int .height( ) $ .queue( [name,] fn( next ) ), [Link]( [name,] fn( ) )
XHR — XMLHttpRequest $ .replaceAll( selector ) Custom
$ .height( val ) $ .queue( [name,] queue ), [Link]( [name,] queue )
int .width( ) Removing $ .animate( params [, duration] [, easing] [, fn] )
Test operations
$ .width( val ) $ .detach( [selector] ) 1.4+ $ .animate( params, options )
[Link] int .innerHeight( ) $ .empty( ) $ .stop( [clearQueue] [, jumpToEnd] )
bool
bool
[Link]( obj )
[Link]( obj ) 1.4+
ver. 21-01-2010 $ .remove( [selector] ) $ .delay( duration [, queueName] ) 1.4+
int .innerWidth( ) bool [Link]( obj )
int .outerHeight( [margin] ) Copying Settings bool [Link]( obj ) 1.4+
int .outerWidth( [margin] ) $ .clone( [withDataAndEvents] ) bool [Link]

You might also like