DEV Community

Ben Halpern
Ben Halpern

Posted on

Who still regularly uses jQuery?

Lots of us are still using it for one reason or another. How about you? What's your story?

Latest comments (98)

Collapse
 
bigbott profile image
bigbott • Edited

I don't see any valid reason to not use jQuery.
The point of jQuery is not ajax or cross-browsing. The point of jQuery is simplicity and concise readable code. Every method in jQuery returns a jQuery object therefore the method chaining is possible. You cannot write such a code in pure JavaScript.

Also, jQuery has 30,000 (according to Github) plugins. Some of them are super popular. For example, Select2 alone used in almost 3% of all websites. It 10 times more than Angular. Can you write such a thing in pure JavaScript? I am sure you can, but it will take you weeks if not months.

Size (27kb gzipped) can matter for about 0.00001% of projects. If it really matters don't use it but don't use React as well otherwise it doesn't make any sense.

SPA (React, Angular, Vue) are not suitable for projects that require indexing by search engines. Old style multiple page jQuery featured website is a better choice for such projects.

But jQuery with very little extra work can be used for creating SPA as well. I have written a very small (150 lines of code) SPA framework that makes routing and organizes code into logical modules, and use it for creating mobile and progressive web apps.

Actually, I don't see any reason to use any of the modern JS frameworks. They are too big, too complex, they mix html, css, js, they use impossible to debug bindings, and so on and so on.

Collapse
 
jcubic profile image
Jakub T. Jankiewicz

I would just add that MediaWiki, which is used by probably the biggest website on Internet the Wikipedia, use jQuery as main JS frameowork. And I don't think it will change. I don't see any reason why you would like to rewrite to something new just because it's invented. jQuery works just fine and it's easy to learn and use.

Collapse
 
arschles profile image
Aaron Schlesinger • Edited

Hot takes incoming!

A ton of sites I've worked on don't really need a larger framework, but I keep noticing that it's dangerously easy to convince myself that I need React, Vue or something similar.

If you're building Spotify, you need a framework. I get that because it's truly an app. But take Facebook or Twitter. Those feel like websites that don't need a framework. That being said, I use Twitter every day, so I'm not complaining or criticizing.

Now that my hot takes are over, I keep some rules in mind when I build a site with jQuery. Some of these I learned from using StimulusJS, which ironically enough is another framework!

  • Try to store state in the DOM itself, right next to the elements that need it. Use data-* attributes for this
  • Try not to use object-oriented design patterns. Keep the code as functional as possible
  • Use typescript when I can
Collapse
 
doug profile image
Doug

I originally used it to solve browser compatibility, and it also helped make the language easier to read (for me!).

Fast forward 10 years, the C# MVC project I was working on is heavily split between backend (API) and frontend (Javascript). Sticking to what I know, there is heavy use of jQuery (also to replace a commercial control library). Eventually I realise this is beyond what it was made for and I'm re-inventing wheels or looking for plugins to help.

These days I get to use Angular, which has it's faults, but I refuse to drop back to the comfortable arms of jQuery, because I'm not having the problems it was originally solving for me.

I have trememndous respect for jQuery, but my coding style and needs have moved on.

Collapse
 
itachiuchiha profile image
Itachi Uchiha

You shouldn't define yourself with a technology or a library or a framework. Actually, jQuery helped developers in a lot of projects.

These are great plugins for jQuery;

jQuery DataTable, FullCalendar, Carousel, tooltipsy, etc.

It still using by WordPress so we can't say it's legacy.

Collapse
 
permanaj profile image
Permana Jayanta

So, is it cool now to hate jQuery? I think I need to follow this cool-driven development

Collapse
 
vladimir_dev profile image
vladimir.dev

Also, I just wanna add, from the coding perspective, I don't find jQuery nearly as annoying as still seeing floats & clearfixes for layout in 2019 πŸ€¦β€β™‚οΈ

Collapse
 
vladimir_dev profile image
vladimir.dev

πŸ™‹β€β™‚οΈ Here!

Reason? Just inheriting and maintaining old projects.

Collapse
 
adebai profile image
Adebowale Ayodeji

When people see some set of new tools, they always forget the good part of the former, and will be blindfolded on the bad part of the later.
As for me, even though I'll ditch jQuery for vue on big projects, jQuery is still ok for some reasons.

  1. Supporting IE, the default browser of windows 7 is very important.
  2. When you use a cdn, the 30kb pain is gone.
  3. It's very cool to replace selectors, but when you try replacing the $.ajax, $('#id').show(), .animate, etc with plain JS, you're really stressing yourself just because "You don't wanna use jQuery"!
  4. Even without any JS knowledge, you can still edit jQuery code (I know what I'm saying!), and approximately every web developer understands jQuery. jQuery's age or modern JS should not judge whether you need a framework/library or not, your project should be the judge! I only wish folks from envato and the likes are here...
Collapse
 
azhsetiawan profile image
Ashar Setiawan

I'm still using JQuery in WordPress theme and simple static site.

Collapse
 
nektro profile image
Meghan (she/her)

I do. I think JS frameworks are the main source of modern bloat and still make my sites fairly hand-crafted. And modern stuff that isn't React/Vue/Angular still use it. I feel calling it "medieval" is very inaccurate.

Collapse
 
leob profile image
leob

I sure do, when I'm not building a 'SPA' ... in fact it's a very well designed library, simple and it just works - when you maintain a little bit of discipline in order to not make it a mess, that is.

A drawback that I don't hear mentioned often is its bundle size - it's surprisingly big considering what it does (I saw that for the next release they're planning to make it smaller). Also it's not really using ES6 as far as I know. And TBH most of what jQuery does can quite easily be done with the native DOM api (and 'fetch' for AJAX).

For my current Laravel project I am considering to replace it with StimulusJS (of Rails fame). However to then completely phase out jQuery I'd also need a solution for Bootstrap which currently has a dependency on jQuery (for Bootstrap 5 they're planning to remove jQuery as a dependency).

But, to make a long story short, yes I've used it on a bunch of projects and am not ashamed to admit it :-)

Collapse
 
not_jffrydsr profile image
@nobody

I remember reading jQuery documentation in 2015 while learning Java Swing and thought 'I'll take this whole web app thing when they've agreed on a syntax'. . . years later that's now the medieval period.

Collapse
 
bugmagnet profile image
Bruce Axtens

Don't forget to ask who is still using vanilla js πŸ˜‰

Collapse
 
enmel profile image
Enmanuel Marval

I do not!!! Huahaha

But some of my coworkers are still clinging to him. A couple have followed my example and have begun to leave it gradually. It is a total success!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.