jQuery Cheatsheet - jQuery API & DOM Manipulation Reference
This reference is for developers who maintain older codebases or browser extensions still built on jQuery, covering the API that lives in every such file: selectors, reading and writing DOM content and attributes, class toggling, event binding and delegation, Ajax shorthand, and simple animations. Unlike a flat jQuery API dump, entries are grouped by the interaction they perform — find elements, manipulate them, respond to events, or fetch data. After reading you should be able to chain a selector into DOM edits, delegate events to stay fast on dynamic lists, and replace a page refresh with an Ajax request.
Selectors 10
$("div") $(".class")$("#id")$("div.class")$("div > p")$("div p")$(":input")$(":checkbox")$("div:first")$("li:eq(2)")DOM Manipulation 10
$("#box").html()$("#box").html("<p>content</p>")$("#box").text()$("#box").val()$("#box").attr("data-id")$("#box").attr("data-id", "123")$("#box").addClass("active")$("#box").removeClass("active")$("#box").toggleClass("active")$("<div>").appendTo("body")Event Binding 8
$("#btn").click(fn)$("#btn").on("click", fn)$("#btn").off("click")$(document).on("click", ".btn", fn)$("input").change(fn)$("form").submit(fn)$(document).ready(fn)$(fn)Ajax Requests 5
$.get("/api/data", fn)$.post("/api/data", { key: "value" }, fn)$.getJSON("/api/data", fn)$.ajax({ url, method, data, success })$.ajaxSetup({ headers: { "X-Token": token } })Animations & Effects 8
$("#box").show()$("#box").hide()$("#box").toggle()$("#box").fadeIn()$("#box").fadeOut()$("#box").slideDown()$("#box").slideUp()$("#box").animate({ left: "200px" }, 500)Tips
- Event delegation $(parent).on('click', '.child', fn) fits dynamically added elements.
- jQuery 3.x removed the success/error callbacks from $.ajax(); use Promises instead.
- For new projects prefer native DOM APIs or Vue/React; jQuery is mainly for legacy maintenance.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us