💛 JavaScript

jQuery to Vanilla JS — The Translation Table

📅 Jul 5, 2026 ⏱ 3 min read

College materials and older codebases still speak jQuery; interviews expect vanilla. The full translation:

The table

// SELECT
$(".card")               → document.querySelectorAll(".card")
$("#app")                → document.querySelector("#app")

// EVENTS
$(btn).on("click", fn)   → btn.addEventListener("click", fn)
$(document).ready(fn)    → defer attribute, or DOMContentLoaded
$(list).on("click", "li", fn) → delegation with e.target.closest("li")

// CLASSES & CONTENT
$(el).addClass("on")     → el.classList.add("on")
$(el).toggleClass("on")  → el.classList.toggle("on")
$(el).text("hi")         → el.textContent = "hi"
$(el).attr("href")       → el.getAttribute("href")
$(el).hide()             → el.hidden = true

// DOM
$(parent).append(el)     → parent.append(el)
$(el).remove()           → el.remove()
$("<li>")                → document.createElement("li")

// AJAX
$.getJSON(url, cb)       → const data = await (await fetch(url)).json()

// ANIMATION
$(el).fadeIn(300)        → CSS transition + el.classList.add("visible")

Why jQuery faded

It papered over 2010's browser inconsistencies — querySelector, fetch and classList didn't exist. The platform absorbed its best ideas ($ becoming querySelector is almost literal). It's not "bad", just redundant — and 30KB of redundant.

Reading legacy jQuery remains a real workplace skill; writing new code in it is the thing to avoid. Full modern DOM: DOM lessons.

← All Articles