Why jQuery is the Most Popular JavaScript Library

John Resig released jQuery on August 26th, 2006 and changed the front-end development landscape forever. jQuery quickly arose to be the go to JavaScript framework.

A number of other libraries came out around the same time such as MooTools and Prototype but there’s a number of reasons why jQuery has surpassed them in popularity.

Reuse of CSS Selectors

jQuery came out around the time web designers and front-end web developers were getting used to creating table-less, semantically marked-up web pages. It was a lot of effort to switch from one way of coding to another. CSS was being learned by the web community en masse.

jQuery used the same CSS selectors that people were using for styling their pages to add behavior. There was no context switching when referring to the same elements.

jQuery also implemented many of the CSS3 selectors prior to browser implementations. This meant you could apply behaviors to elements you couldn’t necessarily select with CSS yet! You didn’t feel you were wasting your time learning new selectors as they’d be eventually supported by modern browsers. In most cases these selectors are widely supported today.

jQuery was forward thinking and kept CSS selectors in the forefront. Other libraries, initially, sought to extend JavaScript and ignore the fresh blood of the new CSS developers and missed out on the opportunity to welcome them into their fold. It was an afterthought to them, the horse had already bolted.

Unobtrusive by Design

Not only did jQuery emulate CSS with it’s selectors, it also employed the same separation from content.

While other JavaScript libraries were struggling with Unobtrusive JavaScript techniques, jQuery made it damn-near impossible to write hacky-in-the-markup-JavaScript.

By its very design, jQuery made it so that if you didn’t know what you were doing with JavaScript you’d write unobtrusive code without even realizing it. Fantastic.

It’s Simple

jQuery didn’t set out to extend JavaScript’s APIs in a JavaScripty way. It was built with the developer in mind. The user of the library. From a developer’s perspective, the user experience for jQuery is a delight.

If you want to hide all paragraph elements with the class of .spoiler call the hide() method.

$("p.spoiler").hide()

But what if you want to remove elements from the DOM? That’s right, you call the remove() method.

$("div.warning").remove()

It’s the principle of least surprise, both because you’re using pre-existing CSS knowledge and because of jQuery’s simple method names. You’ll find yourself guessing methods rather than looking them up in the documentation. When you do go to the documentation there’s plenty of example code to see each part of the jQuery API in action.

Conclusion

By its design, jQuery has allowed novices and pros to improve the experiences of countless numbers of users. It took the impossible job of thinking about both the end-user and the developer and made something that checked all the right boxes.

jQuery is a testament to John Resig and team’s ingenuity. I can’t imagine how much fun I’d have missed out on without jQuery in my toolbox.

Do you use jQuery? Why do you think it’s so popular? I’d love to hear your opinions in the comments below.

Free Workshops

Watch one of our expert, full-length teaching videos. Choose from HTML, CSS or WordPress.

Start Learning

Andrew Chalkley

I'm an alien, I'm a legal alien, I'm an Englishman in Portland. All of my professional life I've worked with computers online. I'm a polyglot programmer and like using the right tools for the job. In my spare time I enjoy spending time with my young family and when I get chance, sticking opponents in Halo 4. You can find me in most places @chalkers.

Comments

6 comments on “Why jQuery is the Most Popular JavaScript Library

  1. Great points Andrew!

    You briefly mentioned it, but the fact that the community and supporters of the jQuery codebase have kept the documentation up to date and accessible is one of the major reasons why it gained so much traction. Sometimes open source frameworks think of the documentation as being secondary (you have the code after all, right?) However, well maintained documentation is vitally important.

    Another reason jQuery has been so strongly adopted is due to the fact that it hides all of those crazy browser inconsistencies, especially with the versions of the browsers that existed at the time of jQuery’s initial release. No crazy checks littering my code to determine what the user agent was.

    Finally, jQuery code has supporting unit tests that ensure that the code isn’t going to break due to an update to the core libraries. This, coupled with the fact that the release notes are well maintained makes adoption and upgrading a much easier task.

  2. jQuery was my first stepping stone to writing JavaScript, its simple syntax was definitely easier to understand than vanilla Javascript when first starting out.

  3. For my opinion, jQuery is most popular library, because she provide very important thing like:
    – You do not need to know a lot of things are happening under the hood. It’s like a machine, you only need to press the start button and press the gas pedal, the rest of the library will do for you.
    – Using css selectors it’s very impressive, you write less and take what you need in one string
    – Chain pattern also, very impressive
    – Don’t worry about work in a lot of browsers

  4. That may be quite attention-grabbing, You are an exceedingly skilled tumblr. I’ve became a member of a person’s rss feed and check forward to around goal of excess of the great submit. As well, I’ve truly embraced your website around my web sites