JavaScript Devs: Is It Worth Learning jQuery?

If you’re learning JavaScript and Web development, you might be wondering whether to learn jQuery. After nearly a decade of existence, jQuery has grown into a fundamental part of JavaScript coding in Web development. First, let’s look at why jQuery came to be, and whether it’s still necessary. Then we’ll wrap it up with some conclusions on whether you should learn it.

Check out the latest JavaScript jobs.

In the early days of Web development, there were some problems that made coding difficult. First, there was very little compatibility between browsers. Microsoft went off in one direction, and other browser manufacturers went in others. In order to write code that could be called in response to a button click, you had to write several versions for different browsers. That was the first problem.

The second problem was there weren’t any efficient ways to “drill down” into your HTML elements. Say you had an element containing other elements, with those elements containing other elements. To access these elements from JavaScript, you pretty much had to give a unique identifier to each element. What developers needed was a uniform way to assign event code to elements, and a uniform way to access the elements.

Several people attempted to create libraries to help simplify the coding. Of these, a couple quickly rose ahead of the others, and of those, one—jQuery—really took off. Within a few years, jQuery became an essential part of writing Web applications. It was so essential that many of us wished some of the jQuery features were built right into the JavaScript implementations in the browsers.

As browser standards evolved, and as Web developers put pressure on Microsoft to conform to standards, the browsers gradually came together. By the time IE9 was released, browsers were pretty well uniform in how they handled events and accessing elements. We were getting closer to being able to write one piece of JavaScript code and have it run on all the major browsers without modification. (We’re technically still not there, but we’re much closer than we had been.) This meant that writing event code was much easier.

Additionally, the Web standards group (W3C) took note of the way jQuery allows you to drill down into your elements, using a method that essentially matches CSS’s way of naming elements. As such, they added some standard methods for accessing your elements using these same CSS selectors.

And now we’re at a point where many of the missing pieces (and additional features) jQuery filled in are present in browsers. So do you need to learn jQuery anymore?

Let’s look to some of the experts to get their take.

In this article over on SitePoint, Craig Buckler makes the argument that jQuery is just an abstraction. Indeed, he’s correct; jQuery is really just JavaScript code that simplifies your day. Anything you do with jQuery, you can still do without jQuery. And over on another blog, Web development guru Todd Motto presents a line-by-line comparison between jQuery calls and native calls, showing that it’s almost as easy these days just to use native calls.

For example, Motto provides this code in jQuery:

var i = $(“.myclass”);

This searches for all elements on the page that have class name myclass. Now here’s a bit of code without jQuery:

var i = document.querySelectorAll(“.myclass”);

This does the same thing, using a function (querySelectorAll) that’s built into the newer browsers.

If you dig further, you’ll find the same conclusion on other blogs: People are realizing they don’t necessarily need jQuery. Indeed, in my own development work, I’ve noticed over the past year that I’m relying on jQuery less and less.

But before we move on, let’s look at jQuery’s official blog. Here, we see that the jQuery developers have stripped out the code needed for older browsers, resulting in a separate version of jQuery that targets only modern browsers. Because it doesn’t need nearly as much browser-specific code, this modern jQuery library is much smaller in code size than previous versions. To me, that sounds like even more of a justification to abandon jQuery, even if the platform’s developers don’t want us to stop using it.

While a lot of people might argue that we don’t need to learn jQuery, there’s still one big reason for doing so: Legacy code. If you’re going to go to work at a company that already has JavaScript browser code, there’s a strong possibility it has jQuery throughout its code. There’s also a matter of preference: With jQuery, my code is tighter; individual lines of code are shorter. People still like jQuery and its elegance, and they’re going to continue using it, even though they might not have to.

If you’re just starting out in Web development, my suggestion is to learn both jQuery as well as JavaScript’s new, native ways of accomplishing the same tasks. Then decide for yourself if you need jQuery.

Upload Your ResumeEmployers want candidates like you. Upload your resume. Show them you’re awesome.

Image: jQuery

10 Responses to “JavaScript Devs: Is It Worth Learning jQuery?”

  1. Many new websites will still continue to be built with JQuery, look at newer frameworks like bootstrap they still utilize this great framework, it’s a decade old but it’s still in good shape and it’s still the most vibrant JS library in the market.

    Best Regards,

  2. jQuery is simple to learn, even for the newbies. What’s wrong in using jQuery? The only drawback I can see in using jQuery is that your code will be slightly bigger than when not using jQuery. Hence the starting time may be a bit longer when visiting your web page for the first time.

  3. While browser contribute to have varying support for the standards jQuery and Zepto.js have a valuable use in abstracting away the differences. For example the bubbling focusIn and foocusout events are not supported by Firefox but can be used safely with these libraries.

    Otherwise I generally agree with you.

  4. The author did not broach the subject of jQuery-UI (along with third party plugins)
    which makes advanced interface objects such as calendars, dialogs, tabs, menus, etc
    (for the most part) relatively simple to create and use.

  5. Rory O'Siochain

    While I haven’t used JQuery in a few years, I don’t regret learning it in the slightest.

    Some benefits (in my mind) of learning JQuery:
    Gives a good foundation for understanding DOM manipulation without a steep learning curve.
    Uses selectors compliant with CSS – as in learning JQuery selectors will help you understand CSS selectors and vice versa.
    While the framework ecosystem seems pretty unstable atm, JQuery remains solid and popular.
    The plugin ecosystem is second to none.

  6. There are some frameworks which go hand in hand with jQuery:
    * Bootstrap
    * AngularJS
    * etc.

    Therefore yes.

    There are some frameworks which don’t need jQuery at all:
    * Meteor.js
    * React
    * etc.

    Therefore it’s not a must.

    But: SizzleJS is not the best part about jQuery. IMHO it’s the event abstraction and the Ajax abstraction which make many things a lot easier. And it eases the pain when you begin to develop JS apps.

  7. 100% YES and Yes if you’re trying to work as a developer. Even if you don’t use it on some newer dev projects, eventually you’ll find older or simple projects where it makes A LOT of sense to use jQuery for convenience.

    While it’s slowly becoming less relevant, it’s still solid for most basic JavaScript uses. And as a beginner it’s a great way to start learning how JavaScript works and the syntax. jQuery is like training wheels for a front end Dev. You gotta start somewhere in JavaScript and you probably will not want to start by attempting to write a fully functioning MEAN stack app written in pure JavaScript right away. It’s best to learn one step at a time.

  8. JQuery is the most mature JS “framework library” available. Its utilities are highly optimized, thoroughly tested, and implemented consistently. Its plugin system provides a rich ecosystem and an elegant mechanism to override default behaviors without changing the core library.

    A better question is should you learn Angular? It is now moving to a controversial 2.x series that is not backward compatible. It encourages developers to write PHP-style embedded logic that is very difficult and expensive to test, and it abstracts so much of what is really happening in the browser (“automatic two-way data binding”) that novice developers are blinded to the possibilies outside its myopic philosophy of web applications.

    I found it funny at the last HTML 5 developer conference in SF that all the presenters were trying to outdo each other claiming how “little” they used jQuery. The take away? They all use jQuery! That’s because its mature, reliable, easy, noninvasive, and performs very well.