Episode 2 of 24

What is jQuery?

Understand what jQuery is, how it simplifies JavaScript, and its "write less, do more" philosophy.

jQuery is a JavaScript library created by John Resig in 2006. Its motto is "Write less, do more" — and it delivers on that promise.

jQuery vs Vanilla JavaScript

Here's a comparison to show how jQuery simplifies common tasks:

// Vanilla JavaScript — select and hide an element
document.getElementById("box").style.display = "none";

// jQuery — same thing, simpler
$("#box").hide();
// Vanilla JavaScript — add click event to all buttons
let buttons = document.querySelectorAll("button");
buttons.forEach(function(btn) {
    btn.addEventListener("click", function() {
        this.style.color = "red";
    });
});

// jQuery — one line
$("button").click(function() {
    $(this).css("color", "red");
});

What jQuery Does

  • DOM manipulation — select, create, modify, and remove elements
  • Event handling — respond to clicks, hovers, keyboard input
  • Animation — fade, slide, and custom animations
  • AJAX — load data from servers without refreshing
  • Cross-browser compatibility — handles browser differences automatically

Is jQuery Still Relevant?

While modern JavaScript (ES6+) has adopted many features jQuery pioneered, jQuery is still:

  • Used on over 70% of all websites
  • Essential for WordPress development
  • A great way to learn library concepts
  • Perfect for small-to-medium projects that don't need a full framework