Skip to content

Instantly share code, notes, and snippets.

@albertomm
Last active May 3, 2016 19:45
Show Gist options
  • Save albertomm/594fa727096f13f156bd7a3ef0ac2f21 to your computer and use it in GitHub Desktop.
Save albertomm/594fa727096f13f156bd7a3ef0ac2f21 to your computer and use it in GitHub Desktop.
JQuery Cheat Sheet
/* Selectors */
$("button"); // by tag name
$(".animated"); // by class name
$("#button3"); // by ID
$("someselector:nth-child(2)");
/* CSS */
$(selector).addClass("someclass");
$(selector).removeClass("someclass");
$(selector).css("color", "blue");
/* HTML */
$(selector).prop("disabled", true);
$(selector).text("Hello World.");
$(selector).html("Hello <em>World</em>.");
$(selector).remove(); // remove selection
$(selector).clone(); // get a copy of the selected element
$(selector).appendTo(selector); // move selection inside another element
$(selector).parent();
$(selector).children();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment