Jquery 1.4 Api Cheat Sheet

ADVERTISEMENT

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

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go