jQuery Cheat Sheet

This jQuery cheat sheet is a great reference for both beginners and experienced developers.

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>