jquery 13 cheatsheet_v1

2
Core $(html, [owner]) $(expr, [context]) $(elems) $(func) jQuery 1.3 Cheat Sheet jQuery Function Interoperability $.noConflict() $.noConflict(extreme) Plugins $.fn.extend(object) $.extend(object) Data data(name) data(name, value) removeData(name) queue(name) queue(name, func) queue(name, queue) dequeue(name) each(func) size() jQuery Object Accessors length selector 1 context 1 eq(index) get() get(index) index(element) jQuery jQuery jQuery jQuery jQuery Number Number String Element Number jQuery Element Array<Element> jQuery jQuery jQuery jQuery jQuery Object Array<Function> jQuery jQuery jQuery jQuery 1) New in jQuery 1.3 FUNCTION RETURNS PROPERTY RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS [ ] | one argument only optional argument argument Legend function functions or properties arguments SYNTAX DESCRIPTION Manipulation wrap(html | element) jQuery wrapInner(html | elem) wrapAll(html | element) jQuery jQuery appendTo(selector) Insert Inside append(content) jQuery jQuery prependTo(selector) prepend(content) jQuery jQuery before(content) Insert Outside after(content) jQuery jQuery insertBefore(content) insertAfter(content) jQuery jQuery Insert Around replaceWith(content) jQuery replaceAll(selector) jQuery Replace empty() jQuery remove([expr]) jQuery Remove clone([events]) jQuery Copy FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS Attributes attr(key, value | func) jQuery removeAttr(name) jQuery attr(props) Attr attr(name) Object jQuery removeClass([class]) addClass(class) Class hasClass(class) Boolean jQuery jQuery toggleClass(class) jQuery jQuery html(value) HTML html() String jQuery text(value) Text text() String jQuery toggleClass(class, switch) FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS Value val() String, Array FUNCTION RETURNS Traversing offsetParent() jQuery prevAll([expr]) jQuery filter(func) Filtering filter(expr) jQuery jQuery is(expr) Boolean map(func) jQuery not(expr) jQuery slice(start, [end]) jQuery children([expr]) Finding add(expr) jQuery jQuery closest([expr]) jQuery contents() jQuery find(expr) jQuery next([expr]) jQuery nextAll([expr]) jQuery parent([expr]) jQuery parents([expr]) jQuery prev([expr]) jQuery siblings([expr]) jQuery end() Chaining andSelf() jQuery jQuery FUNCTION RETURNS FUNCTION RETURNS FUNCTION RETURNS Selectors :visible Visibility Filters :hidden Array<Element> Array<Element> [attr=value] 2 Attribute Filters [attr] 2 Array<Element> Array<Element> [attr!=value] 2 Array<Element> [attr^=value] 2 Array<Element> [attr$=value] 2 Array<Element> [attr*=value] 2 Array<Element> [attr1][attr2][attrN] 2 Array<Element> :last-child :first-child Child Filters :nth-child(index | even | odd | equation) Array<Element> Array<Element> Array<Element> :only-child Array<Element> name #id .class selector1, selectorN Basic * previous + next parent > child previous ~ siblings Hierarchy ancestor descendant Array<Element> Array<Element> Array<Element> Array<Element> Array<Element> Array<Element> Array<Element> Array<Element> Array<Element> :not(selector) :last :even Basic Filters :first Array<Element> Array<Element> Array<Element> Array<Element> :odd Array<Element> :eq(index) Array<Element> :gt(index) Array<Element> :lt(index) Array<Element> :header Array<Element> :animated Array<Element> :text :input Forms :hidden Array<Element> Array<Element> Array<Element> :password Array<Element> :image :radio :checkbox Array<Element> Array<Element> Array<Element> :file Array<Element> :submit :button Array<Element> Array<Element> :reset Array<Element> :checked :disabled Form Filters :enabled Array<Element> Array<Element> Array<Element> :selected Array<Element> :has(selector) :empty Content Filters :contains(text) Array<Element> Array<Element> Array<Element> SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS SELECTOR RETURNS 2) The [@attr] style selectors were removed in jQuery 1.3 :parent Array<Element> val(value) jQuery SYNTAX DESCRIPTION SYNTAX DESCRIPTION SYNTAX DESCRIPTION

Upload: ilesh-raval

Post on 28-Jul-2015

54 views

Category:

Design


2 download

TRANSCRIPT

Page 1: Jquery 13 cheatsheet_v1

Core

$(html, [owner])

$(expr, [context])

$(elems)

$(func)

jQuery 1.3 Cheat Sheet

jQuery Function

Interoperability

$.noConflict()

$.noConflict(extreme)

Plugins

$.fn.extend(object)

$.extend(object)

Data

data(name)

data(name, value)

removeData(name)

queue(name)

queue(name, func)

queue(name, queue)

dequeue(name)

each(func)

size()

jQuery Object Accessors

length

selector 1

context 1

eq(index)

get()

get(index)

index(element)

jQuery

jQuery

jQuery

jQuery

jQuery

Number

Number

String

Element

Number

jQuery

Element

Array<Element>

jQuery

jQuery

jQuery

jQuery

jQuery

Object

Array<Function>

jQuery

jQuery

jQuery

jQuery

1) New in jQuery 1.3

FUNCTION RETURNS

PROPERTY RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

[ ]| one argument only optional argumentargument

Legend

function functions or properties arguments

SYNTAX DESCRIPTION

Manipulation

wrap(html | element) jQuery

wrapInner(html | elem)

wrapAll(html | element) jQuery

jQuery

appendTo(selector)

Insert Inside

append(content) jQuery

jQuery

prependTo(selector)

prepend(content) jQuery

jQuery

before(content)

Insert Outside

after(content) jQuery

jQuery

insertBefore(content)

insertAfter(content) jQuery

jQuery

Insert Around

replaceWith(content) jQuery

replaceAll(selector) jQuery

Replace

empty() jQuery

remove([expr]) jQuery

Remove

clone([events]) jQuery

Copy

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

Attributes

attr(key, value | func) jQuery

removeAttr(name) jQuery

attr(props)

Attr

attr(name) Object

jQuery

removeClass([class])

addClass(class)

Class

hasClass(class) Boolean

jQuery

jQuery

toggleClass(class) jQuery

jQuery

html(value)

HTML

html() String

jQuery

text(value)

Text

text() String

jQuery

toggleClass(class, switch)

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

Value

val() String, Array

FUNCTION RETURNS

Traversing

offsetParent() jQuery

prevAll([expr]) jQuery

filter(func)

Filtering

filter(expr) jQuery

jQuery

is(expr) Boolean

map(func) jQuery

not(expr) jQuery

slice(start, [end]) jQuery

children([expr])

Finding

add(expr) jQuery

jQuery

closest([expr]) jQuery

contents() jQuery

find(expr) jQuery

next([expr]) jQuery

nextAll([expr]) jQuery

parent([expr]) jQuery

parents([expr]) jQuery

prev([expr]) jQuery

siblings([expr]) jQuery

end()

Chaining

andSelf() jQuery

jQuery

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

Selectors

:visible

Visibility Filters

:hidden Array<Element>

Array<Element>

[attr=value] 2

Attribute Filters

[attr] 2 Array<Element>

Array<Element>

[attr!=value] 2 Array<Element>

[attr^=value] 2 Array<Element>

[attr$=value] 2 Array<Element>

[attr*=value] 2 Array<Element>

[attr1][attr2][attrN] 2 Array<Element>

:last-child

:first-child

Child Filters

:nth-child(index | even | odd | equation) Array<Element>

Array<Element>

Array<Element>

:only-child Array<Element>

name

#id

.class

selector1, selectorN

Basic

*

previous + next

parent > child

previous ~ siblings

Hierarchy

ancestor descendant Array<Element>

Array<Element>

Array<Element>

Array<Element>

Array<Element>

Array<Element>

Array<Element>

Array<Element>

Array<Element>

:not(selector)

:last

:even

Basic Filters

:first Array<Element>

Array<Element>

Array<Element>

Array<Element>

:odd Array<Element>

:eq(index) Array<Element>

:gt(index) Array<Element>

:lt(index) Array<Element>

:header Array<Element>

:animated Array<Element>

:text

:input

Forms

:hidden Array<Element>

Array<Element>

Array<Element>

:password Array<Element>

:image

:radio

:checkbox Array<Element>

Array<Element>

Array<Element>

:file Array<Element>

:submit

:button Array<Element>

Array<Element>

:reset Array<Element>

:checked

:disabled

Form Filters

:enabled Array<Element>

Array<Element>

Array<Element>

:selected Array<Element>

:has(selector)

:empty

Content Filters

:contains(text) Array<Element>

Array<Element>

Array<Element>

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

SELECTOR RETURNS

2) The [@attr] style selectors were removed in jQuery 1.3

:parent Array<Element>

val(value) jQuery

SYNTAX DESCRIPTION SYNTAX DESCRIPTIONSYNTAX DESCRIPTION

Page 2: Jquery 13 cheatsheet_v1

Ajax

serializeArray() Array<Object>

serialize() String

load(url, [data], [func])

$.ajax(options)

$.get(url, [data], [func], [type])

XMLHttpRequest

jQuery

XMLHttpRequest

$.getJSON(url, [data], [func]) XMLHttpRequest

$.getScript(url, [func]) XMLHttpRequest

$.post(url, [data], [func], [type]) XMLHttpRequest

Utilities

$.isArray(object) Boolean

$.isFunction(object) Boolean

jQuery 1.3 Cheat Sheet

$.browser.version 5

$.browser 5

$.boxModel 5

$.support.boxModel 6

Browser & Feature Detection

Map

String

Boolean

Boolean

PROPERTY RETURNS

5) Deprecated in jQuery 1.36) New in jQuery 1.3

$.support.cssFloat 6 Boolean

$.support.hrefNormalized 6 Boolean

$.support.htmlSerialize 6 Boolean

$.support.leadingWhitespace 6 Boolean

$.support.noCloneEvent 6 Boolean

$.support.objectAll 6 Boolean

$.support.opacity 6 Boolean

$.support.scriptEval 6 Boolean

$.support.style 6 Boolean

$.support.tbody 6 Boolean

$.extend([deep], target, object1,..., [objectN])

$.each(object, func)

Array & Object Operations

Object

Object

FUNCTION RETURNS

$.grep(array, func, [invert]) Array

$.makeArray(object) Array

$.map(array, func) Array

$.inArray(value, array) Number

$.merge(first, second) Array

$.unique(array) Array

Test OperationsFUNCTION RETURNS

$.trim(string)

String Operations

String

FUNCTION RETURNS

$.param(object)

URLs

String

FUNCTION RETURNS

Effects

show(speed, [func])

show()

hide()

hide(speed, [func])

Basic

jQuery

jQuery

jQuery

jQuery

FUNCTION RETURNS

toggle() jQuery

toggle(switch) jQuery

toggle(speed, [func]) jQuery

slideUp(speed, [func])

slideDown(speed, [func])

Sliding

jQuery

jQuery

FUNCTION RETURNS

slideToggle(speed, [func]) jQuery

fadeOut(speed, [func])

fadeIn(speed, [func])

Fading

jQuery

jQuery

FUNCTION RETURNS

fadeTo(speed, opacity, [func]) jQuery

animate(params, options)

animate(params, [duration], [easing], [func])

Custom

jQuery

jQuery

FUNCTION RETURNS

stop([clearQueue], [gotoEnd]) jQuery

$.fx.off

Settings

Boolean

PROPERTY RETURNS

ajaxError([func])

Events

jQuery

FUNCTION RETURNS

ajaxSend([func]) jQuery

ajaxStart([func]) jQuery

ajaxStop([func]) jQuery

$.ajaxSetup(options)

Miscellaneous

jQuery

FUNCTION RETURNS

RequestsFUNCTION RETURNS

ajaxComplete([func]) jQuery

ajaxSuccess([func]) jQuery

Events

dblclick([func]) 4 jQuery

blur([func]) 4 jQuery

change([func]) 4 jQuery

click([func]) 4 jQuery

bind(type, [data], func) jQuery

one(type, [data], func) jQuery

trigger(event, [data]) jQuery

triggerHandler(event, [data]) Object

unbind([type], [data]) jQuery

CSS

position()

Position

offset() Object {top, left}

Object {top, left}

scrollTop() Integer

scrollTop(value) jQuery

scrollLeft() Integer

scrollLeft(value) jQuery

Dimension

width() Integer

width(value) jQuery

height() Integer

height(value) jQuery

innerWidth() Integer

innerHeight() Integer

outerWidth([options]) Integer

outerHeight([options]) Integer

css(props)

CSS

css(name) String

jQuery

css(name, value) jQuery

Page Load

ready(func) jQuery

Event Handling

live(type, func) 3 jQuery

die([type], [func]) 3 jQuery

Live Events

hover(over, out) jQuery

toggle(func1, func2, ..., [funcN]) jQuery

Interaction Helpers

Event Helpers

error([func]) 4 jQuery

focus([func]) 4 jQuery

keydown([func]) 4 jQuery

keypress([func]) 4 jQuery

keyup([func]) 4 jQuery

load(func) jQuery

mousedown(func) jQuery

mousemove(func) jQuery

mouseout(func) jQuery

mouseover(func) jQuery

mouseup(func) jQuery

resize(func) jQuery

scroll(func) jQuery

select([func]) 4 jQuery

submit([func]) 4 jQuery

unload(func) jQuery

3) New in jQuery 1.34) Omitting the value triggers the events on each matched element

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

FUNCTION RETURNS

stopPropagation() Undefined

isDefaultPrevented() Boolean

target

type

relatedTarget

currentTarget

Event Object

String

Element

Element

Element

PROPERTY RETURNS

pageX String

pageY String

result Object

timeStamp Number

preventDefault() Undefined

isPropagationStopped() Boolean

stopImmediatePropagation() Undefined

isImmediatePropagationStopped() Boolean

FUNCTION RETURNS

[ ]| one argument only optional argumentargument

Legend

function functions or properties arguments

SYNTAX DESCRIPTION SYNTAX DESCRIPTION SYNTAX DESCRIPTIONSYNTAX DESCRIPTION