0% found this document useful (0 votes)
124 views

Jquery Cheatsheet 1 4

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)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Jquery Cheatsheet 1 4

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)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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 jQuery.ajax( 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) )
.class.class 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 str.selector
el.context $ .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],el.get( [index] ) $ .children( [selector] ) $ .hover( fnIn(eventObj), fnOut(eventObj))
:eq(index) Visibility Filters jQuery.ajaxSetup( 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 jQuery.get( url [, data] [, fn( data, status, XHR )] [, type] )
Interoperability $ .next( [selector] ) .change( [fn] ), .mouseenter( [fn] ),
:animated XHR jQuery.getJSON( url [, data] [, fn( data, status )] )
$ jQuery.noConflict( [extreme] ) $ .nextAll( [selector] ) .click( [fn] ), .mouseleave( [fn] ),
XHR jQuery.getScript( url [, fn( data, status )] )
Child Filters Attribute Filters $ .nextUntil( [selector] ) 1.4+ .dblclick( [fn] ), .mousemove( [fn] ),
XHR jQuery.post( 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 jQuery.param( 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 jQuery.support
$ .html( val ), .html( fn(index, html) ) 1.4∗ Inserting Inside preventDefault(), obj jQuery.browser deprecated
:image el relatedTarget,
:reset str .text( ) $ .append( content ), str jQuery.browser.version deprecated
$ .text( val ), .text( fn(index, html) ) 1.4∗ obj result, bool jQuery.boxModel deprecated
:button .append( fn( index, html ) ) 1.4∗ stopImmediatePropagation(),
:file Value $ .appendTo( target ) stopPropagation(), Basic operations
str,arr .val( ) $ .prepend( content ), el target, obj jQuery.each( obj, fn( index, valueOfElement ) )
$ .val( val ), .val( fn() ) 1.4∗ .prepend( fn( index, html ) ) 1.4∗ num timeStamp, obj jQuery.extend( [deep,] target, obj1 [, objN] )
Legend $ .prependTo( target ) str type,
str which arr jQuery.grep( array, fn( element, index ) [, invert] )

Conventional signs
CSS Inserting Outside } arr jQuery.makeArray( obj )
CSS $ .after( content ), .after( fn() ) 1.4∗ arr jQuery.map( 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 jQuery.inArray( val, array )
arr jQuery.merge( first, second )
$ .css( name, val ), .css( map ), Basics
1.4∗ — changed in 1.4 .css( name, fn(index, val) ) 1.4∗ $ .insertAfter( target ) fn jQuery.noop 1.4+
$ .show( [ duration [, fn] ] )
$ .insertBefore( target ) fn jQuery.proxy( fn, scope ), jQuery.proxy( scope, name ) 1.4+
Positioning $ .hide( [ duration [, fn] ] )
Data types obj .offset( ) Inserting Around $ .toggle( [showOrHide] ) arr jQuery.unique( array )
* — anything $ .offset( coord ), $ .unwrap( ) 1.4+ $ .toggle( duration [, fn] ) str jQuery.trim( 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] ), jQuery.dequeue( [name] )
.wrapAll( fn ) 1.4∗ $ .slideUp( duration [, fn] )
int .scrollTop( ) obj jQuery.data( element, key ), jQuery.data( ) 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] ) jQuery.queue( [name] )
str — string .replaceWith( fn ) 1.4∗ $ .fadeTo( duration, opacity [, fn] )
int .height( ) $ .queue( [name,] fn( next ) ), jQuery.queue( [name,] fn( ) )
XHR — XMLHttpRequest $ .replaceAll( selector ) Custom
$ .height( val ) $ .queue( [name,] queue ), jQuery.queue( [name,] queue )
int .width( ) Removing $ .animate( params [, duration] [, easing] [, fn] )
Test operations
$ .width( val ) $ .detach( [selector] ) 1.4+ $ .animate( params, options )
http://futurecolors.ru/jquery/ int .innerHeight( ) $ .empty( ) $ .stop( [clearQueue] [, jumpToEnd] )
bool
bool
jQuery.isArray( obj )
jQuery.isEmptyObject( obj ) 1.4+
ver. 21-01-2010 $ .remove( [selector] ) $ .delay( duration [, queueName] ) 1.4+
int .innerWidth( ) bool jQuery.isFunction( obj )
int .outerHeight( [margin] ) Copying Settings bool jQuery.isPlainObject( obj ) 1.4+
int .outerWidth( [margin] ) $ .clone( [withDataAndEvents] ) bool jQuery.fx.off

You might also like