Docsity

JQuery Cheat Sheet: Selectors and Events, Cheat Sheet of Computer Programming

Toggle sidebar
bg1
JQuery Cheat Sheet
by luigi0555 via cheatography.com/28075/cs/8279/
Selectors
$('*'); $('element');
$('.class'); $('#ID');
$('selector1, selector2, selectorN');
DOM
.append() .prepend()
.appendTo() .prependTo()
.after() .before()
.insertAfter() .insertBefore()
.next() .prev()
.data() .attr('attributeName','atribute')
.removeProp() prop()
.empty() .remove()
.removeAttr() .first()
.last() .children()
.find() .html()
.text(); .val()
.end() .css('styleName','style')
.addClass() .removeClass()
toggleClass() .eq()
.end() not()
var object = $.extend({}, object1, object2);
Animations and Effects
.slideUp() .slideDown()
.width('0px') .height('0px')
.fadeOut(ms) .fadeIn(ms)
.hide(ms) .show(ms)
.fadeToggle() .slideToggle()
.toggle('fast,slow',ms) .finish()
.stop() .queue()
clearQueue() .dequeue()
.animate({'regla:css'},ms,function(){});
Event List
Browser Events
.resize() .scroll()
Document Loading
.holdReady
()
ready()
Event Handler Attachment
.on() .bind()
form events
.blur() .change() .focus()
.select() .submit()
Keyboard Events
.keydown() .keypress() .keyup()
Mouse Events
.click() .dblclick() focusin()
focusout() .hover(handlerIn,H
andlerOut)
.hover(handle
rInOut)
.mousedow
n()
.mouseenter() .mouseleave(
)
.mousemo
ve()
.mouseout() .mouseover()
.mouseup()
basic syntax
$('selector')
.methodOne()
.methodTwo()
.methodN();
encapsulated function
(function(){
})();
Event Object
e.currentTarget e.data
e.isDefaultPrevented() e.namespace
e.isImmediatePropagationStopped()
e.isPropagationStopped()
e.pageX e.pageY
e.preventDefault() e.relatedTarget
e.result
e.stopImmediatePropagation()
e.stopPropagation() e.target
e.timeStamp e.type
e.which
Event Handler
$('selector').event(functionName);
$('selector').event(function(){});
$('selector').on('event',functionName);
$('selector')on('event',functionName(){});
$bind('event',function);
$(this)
AJAX
.ajaxComplete() ajax.Error()
.ajaxSend() .ajaxStart()
.ajaxStop() .ajaxSuccess()
Helper Functions
JQuery.param() .serialize()
serializeArray()
Low-Level Interface
JQuery.ajax() JQuery.ajax.Setup()
ShortHand Methods
JQuery.get() JQuery.getJSON()
JQuery.getScript() JQuery.getScript().load()
JQuery.post()
By luigi0555
cheatography.com/luigi0555/
Published 23rd May, 2016.
Last updated 23rd May, 2016.
Page 1 of 1.
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com

Partial preview of the text

Download JQuery Cheat Sheet: Selectors and Events and more Cheat Sheet Computer Programming in PDF only on Docsity!

JQuery Cheat Sheet

by luigi0555 via cheatography.com/28075/cs/8279/

Selectors $('*'); $('element'); $('.class'); $('#ID'); $('selector1, selector2, selectorN'); DOM .append() .prepend() .appendTo() .prependTo() .after() .before() .insertAfter() .insertBefore() .next() .prev() .data() .attr('attributeName','atribute') .removeProp() prop() .empty() .remove() .removeAttr() .first() .last() .children() .find() .html() .text(); .val() .end() .css('styleName','style') .addClass() .removeClass() toggleClass() .eq() .end() not() var object = $.extend({}, object1, object2); Animations and Effects .slideUp() .slideDown() .width('0px') .height('0px') .fadeOut(ms) .fadeIn(ms) .hide(ms) .show(ms) .fadeToggle() .slideToggle() .toggle('fast,slow',ms) .finish() .stop() .queue() clearQueue() .dequeue() .animate({'regla:css'},ms,function(){}); Event List Browser Events .resize() .scroll() Document Loading .holdReady () ready() Event Handler Attachment .on() .bind() form events .blur() .change() .focus() .select() .submit() Keyboard Events .keydown() .keypress() .keyup() Mouse Events .click() .dblclick() focusin() focusout() .hover(handlerIn,H andlerOut) .hover(handle rInOut) .mousedow n() .mouseenter() .mouseleave( ) .mousemo ve() .mouseout() .mouseover() .mouseup() basic syntax $('selector') .methodOne() .methodTwo() .methodN(); encapsulated function (function(){ })(); Event Object e.currentTarget e.data e.isDefaultPrevented() e.namespace e.isImmediatePropagationStopped() e.isPropagationStopped() e.pageX e.pageY e.preventDefault() e.relatedTarget e.result e.stopImmediatePropagation() e.stopPropagation() e.target e.timeStamp e.type e.which Event Handler $('selector').event(functionName); $('selector').event(function(){}); $('selector').on('event',functionName); $('selector')on('event',functionName(){}); $bind('event',function); $(this) AJAX .ajaxComplete() ajax.Error() .ajaxSend() .ajaxStart() .ajaxStop() .ajaxSuccess() Helper Functions JQuery.param() .serialize() serializeArray() Low-Level Interface JQuery.ajax() JQuery.ajax.Setup() ShortHand Methods JQuery.get() JQuery.getJSON() JQuery.getScript() JQuery.getScript().load() JQuery.post() By luigi cheatography.com/luigi0555/ Published 23rd May, 2016. Last updated 23rd May, 2016. Page 1 of 1. Sponsored by Readability-Score.com Measure your website readability! https://readability-score.com