Jquery 1.5 Api Cheat Sheet

ADVERTISEMENT

Selectors
Attributes
Traversing
Events
AJAX
Basics
Hierarchy
Attributes
Filtering
Page Load
Low-Level Interface
#id
ancestor descendant
str .attr( name )
$ .eq( index )
$ .ready( fn() )
jqXHR jQuery.ajax( options, [settings] )
1.5+
element
parent > child
$ .attr( name, val ), .attr( map ),
$ .first( )
Event Handling
map accepts
bool async = true
.class, .class.class
prev + next
.attr( name, fn(index, attr) )
$ .last( )
fn beforeSend( jqXHR, config)
$ .bind( type [, data ], fn(eventObj) )
*
prev ~ siblings
$ .removeAttr( name )
$ .has( selector ), .has( element )
bool cache = true
$ .bind( type [, data], false )
selector1, selector2
fn complete( jqXHR, status)
$ .filter( selector ), .filter( fn(index) )
Class
$ .bind( array )
map contents
str contentType
bool .is( selector )
$ .addClass( class ),
$ .unbind( [type] [, fn])
Basic Filters
Content Filters
obj context
map converters
.addClass( fn(index, class) )
$ .map( fn(index, element) )
$ .one( type [, data ], fn(eventObj) )
:first
:contains(text)
bool crossDomain
obj, str data
$ .not( selector ), .not( elements ), .not( fn( index ) )
bool .hasClass( class )
fn dataFilter( data, type )
:last
:empty
$ .trigger( event [, data])
$ .removeClass( [class] ),
$ .slice( start [, end] )
bool global = true
map headers
:not(selector)
:has(selector)
obj .triggerHandler( event [, data])
.removeClass( fn(index, class) )
bool ifModified = false
str jsonp
:even
:parent
Tree traversal
$ .delegate( selector, type, [data], handler)
fn jsonpCallback
str password
$ .toggleClass( class [, switch] ),
:odd
$ .children( [selector] )
$ .undelegate( [selector, type, [handler]])
bool processData = true
Visibility Filters
.toggleClass( fn(index, class) [, switch] )
:eq(index)
$ .closest( selector [, context] )
str scriptCharset
map statusCode
Live Events
:hidden
:gt(index)
HTML, text
arr .closest( selectors [, context] )
num timeout
bool traditional
$ .live( eventType [, data], fn() )
:visible
:lt(index)
str .html( )
str type = 'GET'
str url = curr. page
$ .find( selector )
$ .die( ), .die( [eventType] [, fn() ])
:header
str username
fn xhr
$ .html( val ), .html( fn(index, html) )
$ .next( [selector] )
str dataType ∈ {xml, json, script, html}
:animated
Interaction Helpers
str .text( )
$ .nextAll( [selector] )
fn error( jqXHR, status, errorThrown )
$ .hover( fnIn(eventObj), fnOut(eventObj))
$ .text( val ), .text( fn(index, html) )
$ .nextUntil( [selector] )
Child Filters
Attribute Filters
fn success( data, status, jqXHR )
$ .toggle( fn(eventObj), fn2(eventObj) [, ...])
$ .offsetParent( )
Value
jQuery.ajaxSetup( options )
:nth-child(expr)
[attribute]
Event Helpers
:first-child
[attribute=value]
str,arr .val( )
$ .parent( [selector] )
Shorthand Methods
function ( [data,] [fn] )
:last-child
[attribute!=value]
$ .val( val ), .val( fn() )
$ .parents( [selector] )
$ .load( url [, data] [, fn( responseText, status, XHR )] )
$ .blur,
.mousedown,
:only-child
[attribute^=value]
$ .parentsUntil( [selector] )
jqXHR jQuery.get( url [, data] [, fn( data, status, XHR )] [, type] )
.change,
.mouseenter,
[attribute$=value]
CSS
$ .prev( [selector] )
jqXHR jQuery.getJSON( url [, data] [, fn( data, status )] )
.click,
.mouseleave,
[attribute*=value]
$ .prevAll( [selector] )
CSS
jqXHR jQuery.getScript( url [, fn( data, status )] )
.dblclick,
.mousemove,
[attribute|=value]
$ .prevUntil( [selector] )
str .css( name )
.error,
.mouseout,
jqXHR jQuery.post( url [, data] [, fn( data, status )] [, type] )
[attribute~=value]
$ .siblings( [selector] )
$ .css( name, val ), .css( map ),
.focus,
.mouseover,
[attribute]
Global Ajax Event Handlers
.css( name, fn(index, val) )
.focusin,
.mouseup,
Miscellaneous
[attribute2]
$ .ajaxComplete( fn( event, XHR, options ) )
.focusout,
.resize,
$ .add( selector [, context] ), .add( elements ), .add( html )
Positioning
$ .ajaxError( fn( event, XHR, options, thrownError ) )
Forms
Form Filters
.keydown,
.scroll,
$ .andSelf( )
obj .offset( )
$ .ajaxSend( fn( event, XHR, options ) )
.keypress,
.select,
:input
:enabled
$ .contents( )
$ .offset( coord ),
$ .ajaxStart( fn( ) )
.keyup,
.submit,
:text
:disabled
.offset( fn( index, coord ) )
$ .end( )
$ .ajaxStop( fn( ) )
:password
:checked
.load( [data,] fn ),
.unload( [data,] fn )
$ .offsetParent( )
$ .ajaxSuccess( fn(event, XHR, options) )
:radio
:selected
Manipulation
Event object
obj .position( )
:checkbox
Miscellaneous
int .scrollTop( )
event = {
Inserting Inside
:submit
str .serialize( )
el currentTarget,
$ .scrollTop( val )
$ .append( content ), .append( fn( index, html ) )
:image
* data,
[obj] .serializeArray( )
int .scrollLeft( )
$ .appendTo( target )
:reset
bool isDefaultPrevented(),
str jQuery.param( obj, [traditional] )
$ .scrollLeft( val )
$ .prepend( content ), .prepend( fn( index, html ) )
:button
bool isImmediatePropagationStopped(),
bool isPropagationStopped(),
:file
Height and Width
$ .prependTo( target )
Utilities
str namespace,
int .height( )
Inserting Outside
num pageX,
Browser and Feature Detection
Core
$ .height( val ),
$ .after( content ), .after( fn() )
num pageY,
obj jQuery.support
.height( fn(index, height ) )
$ .before( content ), .before( fn() )
preventDefault(),
jQuery function
obj jQuery.browser
deprecated
int .width( )
$ .insertAfter( target )
el relatedTarget,
$ .jQuery( selector [, context] ), .jQuery( element ),
str jQuery.browser.version
deprecated
$ .width( val ), .width(( fn(index, height ) )
obj result,
$ .insertBefore( target )
.jQuery( elementArray ), .jQuery( jQueryObject ),
bool jQuery.boxModel
deprecated
stopImmediatePropagation(),
int .innerHeight( )
.jQuery( )
Inserting Around
stopPropagation(),
Basic operations
int .innerWidth( )
$ .jQuery( html [, ownerDocument] ),
$ .unwrap( )
el target,
obj jQuery.each( obj, fn( index, valueOfElement ) )
int .outerHeight( [margin] )
.jQuery( html, props )
num timeStamp,
$ .wrap( wrappingElement ), .wrap( fn )
obj jQuery.extend( [deep,] target, obj1 [, objN] )
int .outerWidth( [margin] )
$ .jQuery( fn )
str type,
$ .wrapAll(wrappingElement ), .wrapAll( fn )
arr jQuery.grep( array, fn( element, index ) [, invert] )
str which
jQuery Object Accessors
$ .wrapInner( wrappingElement ), .wrapInner( fn )
Deferred
arr jQuery.makeArray( obj )
}
$ .each( fn(index, element) )
Replacing
arr jQuery.map( array, fn( element, index ) )
deferred object = {
num .size( ), .length
Effects
$ .replaceWith( content ), .replaceWith( fn )
num jQuery.inArray( val, array )
def done(doneCallbacks)
str .selector
$ .replaceAll( selector )
arr jQuery.merge( first, second )
Basics
def fail(failCallbacks)
el .context
fn jQuery.noop
Removing
$ .show( [ duration [, easing] [, fn] ] )
bool isRejected()
$ .eq( index )
fn jQuery.proxy( fn, scope ), jQuery.proxy( scope, name )
$ .detach( [selector] )
$ .hide( [ duration [, easing] [, fn] ] )
bool isResolved()
jQuery.error( str )
fn jQuery.sub( )
1.5+
$ .empty( )
$ .toggle( [showOrHide] )
def reject([args])
[el],el .get( [index] )
arr jQuery.unique( array )
$ .remove( [selector] )
$ .toggle( duration [, easing] [, fn] )
def rejectWith(context, [args])
num .index( )index( selector )index( element )
str jQuery.trim( str )
def resolve([args])
Copying
Sliding
$ jQuery.pushStack( elements, [name, arguments] )
obj jQuery.parseJSON( str )
def resolveWith(context, [args])
$ .slideDown( duration [, easing] [, fn] )
arr .toArray( )
$ .clone( [withDataAndEvents], [deepWithDataAndEvents] )
1.5∗
Data functions
def then(doneCallbacks, failCallbacks)
$ .slideUp( duration [, easing] [, fn] )
Interoperability
}
$ .clearQueue( [name] )
1.5+
$ .slideToggle( [duration] [, easing] [, fn] )
$ jQuery.noConflict( [extreme] )
$ .dequeue( [name] ), jQuery.dequeue( [name] )
def .when(deferreds)
1.5+
Fading
obj jQuery.data( element, key ), jQuery.data( )
$ .fadeIn( duration [, easing] [, fn] )
obj .data( ), .data( key )
http://
$ .fadeOut( duration [, easing] [, fn] )
$ .data( key, val ), .data( obj )
$ .fadeTo( [duration,] opacity [, easing] [, fn] )
ver. 04-02-2011
$ .removeData( [name] )
$ .fadeToggle( [duration,] [, easing] [, fn] )
[fn] .queue( [name] ) jQuery.queue( [name] )
Custom
$ .queue( [name,] fn( next ) ),
$ .animate( params [, duration] [, easing] [, fn] )
jQuery.queue( [name,] fn( ) )
$ .animate( params, options )
$ .queue( [name,] queue ),
$ .stop( [clearQueue] [, jumpToEnd] )
jQuery.queue( [name,] queue )
jQuery 1.5 API Cheat Sheet
$ .delay( duration [, queueName] )
Test operations
Settings
str jQuery.type( obj )
bool jQuery.fx.off
bool jQuery.isArray( obj )
num jQuery.fx.interval
bool jQuery.isEmptyObject( obj )
bool jQuery.isFunction( obj )
bool jQuery.isPlainObject( obj )
bool jQuery.isWindow( obj )

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go