jQuery Cheat Sheet
This jQuery cheat sheet is a great reference for both beginners and experienced developers.
Miscellaneous
Utilities
- jQuery.boxModel
- jQuery.browser
- jQuery.contains()
- jQuery.each()
- jQuery.extend()
- jQuery.globalEval()
- jQuery.grep()
- jQuery.inArray()
- jQuery.isArray()
- jQuery.isEmptyObject()
- jQuery.isFunction()
- jQuery.isNumeric()
- jQuery.isPlainObject()
- jQuery.isWindow()
- jQuery.isXMLDoc()
- jQuery.makeArray()
- jQuery.map()
- jQuery.merge()
- jQuery.noop()
- jQuery.now()
- jQuery.parseHTML()
- jQuery.parseJSON()
- jQuery.parseXML()
- jQuery.proxy()
- jQuery.support
- jQuery.trim()
- jQuery.type()
- jQuery.unique()
- jQuery.uniqueSort()
Deferred Object
- jQuery.Deferred()
- deferred.always()
- deferred.done()
- deferred.fail()
- deferred.isRejected()
- deferred.isResolved()
- deferred.notify()
- deferred.notifyWith()
- deferred.pipe()
- deferred.progress()
- deferred.promise()
- deferred.reject()
- deferred.rejectWith()
- deferred.resolve()
- deferred.resolveWith()
- deferred.state()
- deferred.then()
- .promise()
jQuery Events
Event Object
- event.currentTarget
- event.delegateTarget
- event.data
- event.isDefaultPrevented()
- event.isImmediatePropagationStopped()
- event.isPropagationStopped()
- event.metaKey
- event.namespace
- event.pageX
- event.pageY
- event.preventDefault()
- event.relatedTarget
- event.result
- event.stopImmediatePropagation()
- event.stopPropagation()
- event.target
- event.timeStamp
- event.type
- event.which
Getting Started
jQuery document ready
$(document).ready(function() {
// Runs after the DOM is loaded.
alert('DOM fully loaded!');
});
$(function(){
// Runs after the DOM is loaded.
alert('DOM fully loaded!');
});
jQuery syntax
$(selector).methodOrFunction();
#Example:
$('#menu').on('click', () =>{
$(this).hide();
});
$("body").css("background", "red");
Including jQuery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
#Official CDN
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>