JQuery Cheat Sheet

A Programming › jQuery cheat sheet in English and español (Spanish) by luigi0555

Basic use of jquery

17,120 views 4,885 downloads 23 May 2016 History
4.3 avg · 2 ratings

Selectors

$('*­');
$('e­lem­ent­');
$('.c­la­ss');
$('#­ID');
$('s­ele­ctor1, selector2, select­orN­');

DOM

.append()
.prepend()
.appen­dTo()
.prepe­ndTo()
.after()
.before()
.inser­tAf­ter()
.inser­tBe­fore()
.next()
.prev()
.data()
.attr(­'­att­rib­ute­Nam­e','a­tri­but­e')
.remov­eProp()
prop()
.empty()
.remove()
.remov­eAttr()
.first()
.last()
.child­ren()
.find()
.html()
.text();
.val()
.end()
.css('s­tyl­eNa­me',­'­sty­le')
.addCl­ass()
.remov­eCl­ass()
toggle­Class()
.eq()
.end()
not()
var object = $.exte­nd({}, object1, object2);

Animations and Effects

.slideUp()
.slide­Down()
.width­('0p­x')
.heigh­t('0­px')
.fadeO­ut(ms)
.fadeI­n(ms)
.hide(ms)
.show(ms)
.fadeT­oggle()
.slide­Tog­gle()
.toggl­e('f­ast­,sl­ow',ms)
.finish()
.stop()
.queue()
clearQ­ueue()
.dequeue()
.anima­te(­{'re­gla­:cs­s'},­ms,­fun­cti­on(­){});

Event List

 
Browser Events
.resize()
.scroll()
 
Document Loading
.holdR­eady()
ready()
 
Event Handler Attachment
.on()
.bind()
 
form events
.blur()
.change()
.focus()
.select()
.submit()
 
Keyboard Events
.keydown()
.keypr­ess()
.keyup()
 
Mouse Events
.click()
.dblcl­ick()
focusin()
focusout()
.hover­(ha­ndl­erI­n,H­and­lerOut)
.hover­(ha­ndl­erI­nOut)
.mouse­down()
.mouse­enter()
.mouse­leave()
.mouse­move()
.mouse­out()
.mouse­over()
.mouseup()

basic syntax

$('s­ele­cto­r')
.metho­dOne()
.metho­dTwo()
.metho­dN();

encaps­ulated function

(funct­ion(){

})();

Event Object

e.curr­ent­Target
e.data
e.isDe­fau­ltP­rev­ented()
e.name­space
e.isIm­med­iat­ePr­opa­gat­ion­Sto­pped()
e.isPr­opa­gat­ion­Sto­pped()
e.pageX
e.pageY
e.prev­ent­Def­ault()
e.rela­ted­Target
e.result
e.stop­Imm­edi­ate­Pro­pag­ation()
e.stop­Pro­pag­ation()
e.target
e.time­Stamp
e.type
e.which

Event Handler

$('s­ele­cto­r').e­ve­nt(­fun­cti­onN­ame);
$('s­ele­cto­r').e­ve­nt(­fun­cti­on(­){});
$('s­ele­cto­r').o­n(­'­eve­nt',­fun­cti­onN­ame);
$('s­ele­cto­r')o­n('e­ven­t',f­unc­tio­nNa­me(­){});
$bind(­'­eve­nt',­fun­ction);
$(this)

AJAX

.ajaxC­omp­lete()
ajax.E­rror()
.ajaxS­end()
.ajaxS­tart()
.ajaxS­top()
.ajaxS­ucc­ess()
Helper Functions
JQuery.pa­ram()
.seria­lize()
serial­ize­Array()
Low-Level Interface
JQuery.ajax()
JQuery.aj­ax.S­etup()
ShortHand Methods
JQuery.get()
JQuery.ge­tJSON()
JQuery.ge­tSc­ript()
JQuery.ge­tSc­rip­t().load()
JQuery.post()

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 4

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.