Jquery

Solo disponible en BuenasTareas
  • Páginas : 5 (1120 palabras )
  • Descarga(s) : 0
  • Publicado : 27 de febrero de 2011
Leer documento completo
Vista previa del texto
Selectors
Basics
#id element .class, .class.class * selector1, selector2

Hierarchy

Core

ancestor descendant parent > child prev + next prev ~ siblings

jQuery function

Traversing
Filtering
$ $ $ $ .eq( index ) .first( ) 1.4+ .last( ) 1.4+ .has( selector ), .has( element ) 1.4+ .filter( selector ), .filter( fn(index) ) .is( selector ) .map( fn(index, element) ) .not( selector ),.not( elements ), .not( fn( index ) ) .slice( start [, end] )

Events
$ $ $ $ $ $ obj $ $

$ .jQuery( selector [, context] ), .jQuery( element ), .jQuery( elementArray ), .jQuery( jQueryObject ), .jQuery( ) 1.4∗ ∗ $ .jQuery( html [, ownerDocument] ), .jQuery( html, props ) 1.4∗ ∗ $ .jQuery( fn )

Page Load

AJAX

$ .ready( fn() ) .bind( type [, data ], fn(eventObj) ) .bind( type [,data], false ) 1.4∗ ∗ .bind( array ) 1.4∗ ∗ .unbind( [type] [, fn]) .one( type [, data ], fn(eventObj) ) .trigger( event [, data]) .triggerHandler( event [, data]) .delegate( selector, type, [data], handler) 1.4+ .undelegate( [selector, type, [handler]]) 1.4+

Low-Level Interface

Event Handling

Basic Filters

:first :last :not(selector) :even :odd :eq(index) :gt(index) :lt(index) :header:animated

Content Filters
:contains(text) :empty :has(selector) :parent

Visibility Filters
:hidden :visible

Child Filters

:nth-child(expr) :first-child :last-child :only-child

Attribute Filters

[attribute] [attribute=value] [attribute!=value] [attribute^=value] [attribute$=value] [attribute*=value] [attribute|=value] [attribute~=value] [attribute] [attribute2]

.each(fn(index, element) ) .size( ), .length .selector $ .context .eq( index ) Tree traversal jQuery.error( str ) 1.4+ $ .children( [selector] ) [el],el .get( [index] ) $ .closest( selector [, context] ) 1.4∗ ∗ num .index( ) 1.4∗ .index( selector ) 1.4∗ ∗, ∗, arr .closest( selectors [, context] ) 1.4+ .index( element ) $ .find( selector ) $ jQuery.pushStack( elements, [name, arguments] ) $ .next( [selector]) arr .toArray( ) 1.4+ $ .nextAll( [selector] ) $ .nextUntil( [selector] ) 1.4+ Interoperability $ .offsetParent( ) $ jQuery.noConflict( [extreme] ) $ .parent( [selector] ) $ .parents( [selector] ) $ .parentsUntil( [selector] ) 1.4+ Attributes $ .prev( [selector] ) str .attr( name ) $ .prevAll( [selector] ) $ .attr( name, val ), .attr( map ), $ .prevUntil( [selector] ) 1.4+ .attr( name, fn(index,attr) ) $ .siblings( [selector] ) $ .removeAttr( name ) $ num str el $

jQuery Object Accessors

$ bool $ $

Live Events

$ .live( eventType [, data], fn() ) $ .die( ) 1.4+, .die( [eventType] [, fn() ]) $ .hover( fnIn(eventObj), fnOut(eventObj)) $ .toggle( fn(eventObj), fn2(eventObj) [, ...])

XHR jQuery.ajax( options ) bool async = true fn beforeSend( XHR ) bool cache = true fncomplete(XHR, status) str contentType obj context obj, str data fn dataFilter( data, type ) bool global = true bool ifModified = false str jsonp fn jsonpCallback str password bool processData = true num timeout str type = 'GET' str url = curr. page str username fn xhr str scriptCharset str dataType ∈ {xml, json, script, html} fn error( XHR, status, errorThrown ) fn success( data, status, XHR )jQuery.ajaxSetup( options ) .load( url [, data] [, fn( responseText, status, XHR )] ) jQuery.get( url [, data] [, fn( data, status, XHR )] [, type] ) jQuery.getJSON( url [, data] [, fn( data, status )] ) jQuery.getScript( url [, fn( data, status )] ) jQuery.post( url [, data] [, fn( data, status )] [, type] ) .ajaxComplete( fn( event, XHR, options ) ) .ajaxError( fn( event, XHR, options, thrownError ) ).ajaxSend( fn( event, XHR, options ) ) .ajaxStart( fn( ) ) .ajaxStop( fn( ) ) .ajaxSuccess( fn(event, XHR, options) )

Interaction Helpers Event Helpers

Shorthand Methods
$ XHR XHR XHR XHR $ $ $ $ $ $

Attributes

Class

Forms

:input :text :password :radio :checkbox :submit :image :reset :button :file

Form Filters
:enabled :disabled :checked :selected

$ .addClass( class ),...
tracking img