Jquery Cheat Sheet

Page 1

jQuery 1.3 Cheat Sheet Core jQuery Function

Selectors Basic

Attribute Filters

FUNCTION

RETURNS

SELECTOR

RETURNS

$(expr, [context])

jQuery

*

Array<Element>

$(html, [owner])

jQuery

#id

Array<Element>

[attr=value]

2

Array<Element>

$(elems)

jQuery

name

Array<Element>

[attr!=value]

2

Array<Element>

$(func)

jQuery

.class

Array<Element>

[attr^=value]

2

Array<Element>

selector1, selectorN

Array<Element>

[attr$=value]

2

Array<Element>

[attr*=value]

2

jQuery Object Accessors PROPERTY

RETURNS

selector

1

context

1

Element

RETURNS

ancestor descendant

Array<Element>

length

Number

parent > child

Array<Element>

RETURNS

size()

Number

previous + next

Array<Element>

jQuery Array<Element>

get(index)

previous ~ siblings

Array<Element>

SELECTOR

RETURNS

:first

Array<Element>

Array<Element> 2

Array<Element>

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

Basic Filters

Element

Array<Element>

[attr1][attr2][attrN]

SELECTOR

FUNCTION

get()

RETURNS

[attr]

Hierarchy

String

eq(index)

SELECTOR 2

Child Filters SELECTOR

RETURNS

:nth-child(index | even | odd | equation)

Array<Element>

:first-child

Array<Element>

:last-child

Array<Element>

:only-child

Array<Element>

index(element)

Number

:last

Array<Element>

each(func)

jQuery

:not(selector)

Array<Element>

SELECTOR

RETURNS

:even

Array<Element>

:hidden

Array<Element>

1) New in jQuery 1.3

Data

Forms

FUNCTION

RETURNS

:odd

Array<Element>

:input

Array<Element>

data(name)

Object

:eq(index)

Array<Element>

:text

Array<Element>

data(name, value)

jQuery

:gt(index)

Array<Element>

:password

Array<Element>

removeData(name)

jQuery

:lt(index)

Array<Element>

:checkbox

Array<Element>

queue(name)

Array<Function>

:header

Array<Element>

:radio

Array<Element>

queue(name, func)

jQuery

:animated

Array<Element>

:image

Array<Element>

queue(name, queue)

jQuery

:file

Array<Element>

dequeue(name)

jQuery

:button

Array<Element>

:submit

Array<Element>

:reset

Array<Element>

Content Filters

Plugins

SELECTOR

RETURNS

:contains(text)

Array<Element>

:empty

Array<Element>

FUNCTION

RETURNS

$.fn.extend(object)

jQuery

:has(selector)

Array<Element>

$.extend(object)

jQuery

:parent

Array<Element>

Interoperability FUNCTION

RETURNS

$.noConflict()

jQuery

$.noConflict(extreme)

jQuery

Visibility Filters SELECTOR

RETURNS

:hidden

Array<Element>

:visible

Array<Element>

Attributes Attr

Form Filters SELECTOR

RETURNS

:enabled

Array<Element>

:disabled

Array<Element>

:checked

Array<Element>

:selected

Array<Element>

Manipulation Insert Inside

Traversing Filtering

FUNCTION

RETURNS

FUNCTION

RETURNS

FUNCTION

RETURNS

attr(name)

Object

append(content)

jQuery

filter(expr)

jQuery

attr(props)

jQuery

appendTo(selector)

jQuery

filter(func)

jQuery

attr(key, value | func)

jQuery

prepend(content)

jQuery

is(expr)

Boolean

removeAttr(name)

jQuery

prependTo(selector)

jQuery

map(func)

jQuery

not(expr)

jQuery

slice(start, [end])

jQuery

Class

Insert Outside

FUNCTION

RETURNS

FUNCTION

RETURNS

hasClass(class)

Boolean

after(content)

jQuery

addClass(class)

jQuery

before(content)

jQuery

removeClass([class])

jQuery

insertAfter(content)

toggleClass(class)

jQuery

insertBefore(content)

toggleClass(class, switch)

jQuery

RETURNS

jQuery

add(expr)

jQuery

jQuery

children([expr])

jQuery

closest([expr])

jQuery

contents()

jQuery

find(expr)

jQuery

next([expr])

jQuery

nextAll([expr])

jQuery

prev([expr])

jQuery

jQuery

prevAll([expr])

jQuery

jQuery

offsetParent()

jQuery

parent([expr])

jQuery

Insert Around

HTML

FUNCTION

RETURNS

wrap(html | element)

jQuery

FUNCTION

RETURNS

html()

String

wrapAll(html | element)

jQuery

html(value)

jQuery

wrapInner(html | elem)

jQuery

Text FUNCTION

Replace RETURNS

text()

FUNCTION

RETURNS

replaceWith(content)

String

text(value)

Finding FUNCTION

replaceAll(selector)

jQuery

Value

Remove

FUNCTION

RETURNS

FUNCTION

RETURNS

parents([expr])

jQuery

val()

String, Array

empty()

jQuery

siblings([expr])

jQuery

val(value)

jQuery

remove([expr])

jQuery

Chaining FUNCTION

RETURNS

FUNCTION

RETURNS

andSelf()

jQuery

clone([events])

jQuery

end()

jQuery

Copy

Legend SYNTAX

function

DESCRIPTION

functions or properties

SYNTAX

argument

DESCRIPTION

arguments

SYNTAX

|

DESCRIPTION

one argument only

SYNTAX

[]

DESCRIPTION

optional argument


jQuery 1.3 Cheat Sheet Events Page Load

CSS CSS

Utilities Browser & Feature Detection

FUNCTION

RETURNS

FUNCTION

RETURNS

ready(func)

jQuery

css(name)

String

$.browser

css(props)

jQuery

$.browser.version

css(name, value)

jQuery

$.boxModel

Event Handling FUNCTION

RETURNS

bind(type, [data], func)

jQuery

one(type, [data], func)

jQuery

trigger(event, [data])

PROPERTY

Position

jQuery

offset()

Object {top, left}

triggerHandler(event, [data])

Object

position()

Object {top, left}

unbind([type], [data])

jQuery

scrollTop()

Integer

scrollTop(value)

jQuery

scrollLeft()

Integer

scrollLeft(value)

jQuery

FUNCTION

RETURNS 3

jQuery 3

die([type], [func])

hover(over, out)

jQuery

$.support.noCloneEvent $.support.opacity

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

jQuery

Event Helpers FUNCTION

blur([func])

4

change([func]) 4

click([func])

4

dblclick([func]) error([func])

4

focus([func])

4

Integer

width(value)

jQuery

$.support.tbody

height()

Integer

Array & Object Operations FUNCTION

RETURNS

Object

jQuery

innerHeight()

Integer

outerWidth([options])

Object

jQuery

Integer

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

jQuery

outerHeight([options])

Integer

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

Array

$.makeArray(object)

Array

jQuery

Effects Basic jQuery

$.merge(first, second)

Array

$.unique(array)

Array

jQuery jQuery

load(func)

jQuery

mousedown(func)

jQuery

hide(speed, [func])

jQuery

mousemove(func)

jQuery

toggle()

jQuery

mouseout(func)

jQuery

toggle(switch)

jQuery

mouseover(func)

jQuery

toggle(speed, [func])

jQuery

jQuery jQuery jQuery jQuery

Test Operations

FUNCTION

RETURNS

slideDown(speed, [func])

jQuery

slideUp(speed, [func])

jQuery

slideToggle(speed, [func])

jQuery

FUNCTION

RETURNS

$.isArray(object)

Boolean

$.isFunction(object)

Boolean

String Operations

Sliding

FUNCTION

RETURNS

$.trim(string)

String

URLs FUNCTION

RETURNS

$.param(object)

String

jQuery

Event Object PROPERTY

RETURNS

type

String

Ajax Requests

Fading

jQuery

FUNCTION

RETURNS

fadeIn(speed, [func])

jQuery

fadeOut(speed, [func])

jQuery

fadeTo(speed, opacity, [func])

jQuery

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

Custom

target

Element

relatedTarget

Element

currentTarget

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

jQuery

Element

pageX

String

animate(params, options)

jQuery

pageY

String

stop([clearQueue], [gotoEnd])

jQuery

FUNCTION

result

Number

RETURNS

show(speed, [func])

scroll(func)

Array

$.inArray(value, array)

FUNCTION

jQuery

resize(func)

$.map(array, func)

show() hide()

4

Boolean

$.each(object, func)

jQuery

unload(func)

Boolean

6

jQuery

4

submit([func])

Boolean

jQuery

keydown([func])

4

Boolean 6

Integer

keypress([func])

select([func])

Boolean

6

innerWidth()

jQuery

mouseup(func)

Boolean

height(value)

4

keyup([func])

Boolean

6

5) Deprecated in jQuery 1.3 6) New in jQuery 1.3

jQuery

4

Boolean 6

6

$.support.style

RETURNS 4

Boolean

6

6

$.support.objectAll

RETURNS

width()

Boolean 6

$.support.leadingWhitespace

$.support.scriptEval

FUNCTION RETURNS

Boolean

6

$.support.htmlSerialize

Dimension Interaction Helpers

Boolean 6

$.support.hrefNormalized

jQuery

FUNCTION

String

5

$.support.cssFloat

RETURNS

live(type, func)

Map 5

$.support.boxModel

FUNCTION

Live Events

RETURNS 5

Object

FUNCTION

RETURNS

$.ajax(options)

XMLHttpRequest

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

jQuery

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

XMLHttpRequest

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

XMLHttpRequest

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

XMLHttpRequest

$.getScript(url, [func])

XMLHttpRequest

RETURNS

Events

Settings

FUNCTION

RETURNS

ajaxComplete([func])

jQuery

PROPERTY

RETURNS

ajaxSuccess([func])

jQuery

$.fx.off

Boolean

ajaxError([func])

jQuery

timeStamp

Number

FUNCTION

RETURNS

preventDefault()

Undefined

ajaxSend([func])

jQuery

isDefaultPrevented()

Boolean

ajaxStart([func])

jQuery

stopPropagation()

Undefined

ajaxStop([func])

jQuery

isPropagationStopped()

Boolean

stopImmediatePropagation()

Undefined

isImmediatePropagationStopped()

Boolean

Miscellaneous FUNCTION

RETURNS

$.ajaxSetup(options)

jQuery

serialize()

String

serializeArray()

Array<Object>

Legend SYNTAX

function

DESCRIPTION

functions or properties

SYNTAX

argument

DESCRIPTION

arguments

SYNTAX

|

DESCRIPTION

one argument only

SYNTAX

[]

DESCRIPTION

optional argument


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.