Vanilla JS

Vanilla JS vs jQuery: which should you use today?

Answer:

Vanilla JavaScript is the stronger default today; fetch, querySelector, and classList now do what jQuery's $ wrapper was built for.

How do vanilla JS and jQuery compare today?

FactorjQueryVanilla JS
DOM and AJAX API parity$('.foo').addClass() and $.ajax() wrap the DOM in shorter syntaxquerySelectorAll, classList, and fetch cover the same ground natively
Bundle size and dependency costRoughly 30KB minified and gzipped, plus a version to track and patchZero extra bytes, nothing to update or audit
Cross-browser needBuilt in 2006 to paper over IE6 to IE9 quirks in DOM and event handlingEvergreen Chrome, Firefox, Safari, and Edge now implement the same DOM standards
Where it still persistsBundled inside WordPress core, and much of its plugin ecosystem calls it directlyRare outside WordPress-adjacent or legacy codebases
Learning curve and hiring poolQuick to pick up, still widely known from older projectsRequires knowing more of the underlying DOM API, but it is what any JS hire already uses day to day

When does jQuery still make sense?

jQuery keeps earning its place inside WordPress work, since core and most of the plugin ecosystem, from carousels to form validators, already assume it is loaded on the page. It also fits a codebase you inherited that is already built on jQuery plugins with no rewrite budget attached; ripping it out to save a few kilobytes rarely justifies the regression risk. Outside those two situations, reaching for it on a new project mostly adds a dependency you do not need.

When is vanilla JS the right call?

Any new project without an existing jQuery dependency should start in vanilla JS. The DOM APIs jQuery once smoothed over, addEventListener, fetch, classList, querySelector, now behave the same way across every evergreen browser, so the library's original job is mostly done for you by the platform itself. Performance-sensitive pages benefit too: skipping the extra request and parse time for a library you are using for a handful of selectors and toggles is a measurable win, not a theoretical one.

Who should choose which?

Teams maintaining WordPress sites, jQuery-plugin-heavy admin panels, or older codebases without a rewrite budget are better off working within jQuery rather than fighting it. Teams starting a new project, building a marketing site, or optimizing an existing performance-critical page should default to vanilla JS and reach for jQuery only if a specific plugin genuinely requires it. Either way, understanding the underlying DOM API pays off, since jQuery is a thin layer over it and vanilla JS is simply that layer without the wrapper.

Curved left line
We're Here to Help

Thinking about how to expand a tech team flexibly to adapt to different working paces?

Accelerate development, meet launch deadlines with flexible, much-needed capacity. Add new skills your team currently lacks.

Curved right line