Show Menu
Cheatography

Basic use of jquery

Selectors

$('*');
$('ele­ment');
$('.cl­ass');
$('#ID');
$('sel­ector1, selector2, select­orN');

DOM

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

Anim­ations and Effects

.slideUp()
.slide­Down()
.width­('0px')
.heigh­t('­0px')
.fadeO­ut(ms)
.fadeI­n(ms)
.hide(ms)
.show(ms)
.fadeT­oggle()
.slide­Tog­gle()
.toggl­e('­fas­t,s­low­',ms)
.finish()
.stop()
.queue()
clearQ­ueue()
.dequeue()
.anima­te(­{'r­egl­a:c­ss'­},m­s,f­unc­tio­n(){});
 

Event List

 
Browser Events
.resize()
.scroll()
 
Document Loading
.holdR­eady()
ready()
 
Event Handler Attach­ment
.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

$('sel­ector')
.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

$('sel­ect­or'­).e­ven­t(f­unc­tio­nName);
$('sel­ect­or'­).e­ven­t(f­unc­tio­n(){});
$('sel­ect­or'­).o­n('­eve­nt'­,fu­nct­ion­Name);
$('sel­ect­or'­)on­('e­ven­t',­fun­cti­onN­ame­(){});
$bind(­'ev­ent­',f­unc­tion);
$(this)

AJAX

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

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Web Programming Cheat Sheet
          jQuery Cheat Sheet
          jQuery Mobile Cheat Sheet