Ever since I made the leap to learn web development so I could offer web development services at my computer repair store, I fell in love with jQuery. It made creating powerful functions simple and easy. I felt like I was cheating with how easy it was. Only later did I learn of the disadvantages and drawbacks of relying too much on jQuery.
History Of jQuery
No one enjoys a history lesson more than the history teacher himself. And to keep it short and crisp, you should know that jQuery was developed by John Resig in 2005 and was released to the public a year later at BarCampNYC.
There were two main goals of the library; the first goal of jQuery was to provide an ergonomic API that can be used to manipulate a webpage. This provided coders with an extremely powerful way to select elements.
The best part about the library was that it was not limited to selecting elements based on their classes and IDs but could also be used for complex expressions. For instance, you could use jQuery to select elements based on their relationship with other elements.
Whereas the second goal that the library achieved is that it absorbed the differences between browsers, as back then, it was extremely difficult to have codes that worked flawlessly on all browsers.
The lack of standardized code made the developer’s life incredibly hard as they encountered different edge cases and browser behavior. Later on, the library made more sophisticated techniques easy to adopt, techniques like Ajax and animations.
A Brief Timeline of jQuery
- The jQuery board was initially created in 2011
- In 2012, the jQuery board created a jQuery foundation making stewardship of jQuery more formal.
- In 2015, jQuery Foundation and Dojo foundation merged to create the JS Foundation.
- The JS Foundation then merged with the Node.js Foundation in 2019.
When To Use jQuery & When To Avoid
Knowing the right time to use jQuery is extremely crucial. If you are dealing with a project that will grow in complexity, then it is not recommended to use jQuery.
A project can be considered complex when you want to break the UI into different components, and there are better frameworks than jQuery that can help you do that.
This is mainly because, at first, things might look easy, but later on, you will end up with a spaghetti code in which you won’t be sure which part of the code affects which part of the webpage.
Now, if you are wondering if jQuery would be best for small web pages with little to no dynamic content, you might want to reconsider that thought. Thanks to the native APIs, now you can say goodbye to jQuery for small webpages as well.
Through jQuery documentation, you can skip all the hard work of learning various native APIs or special purpose libraries and start being productive with jQuery instantly.
You can also feel free to use jQuery in websites that are bound to be simple and won’t become much more complicated. You must also avoid bothering native functionalities in such cases, as the code can get wordier than an equivalent jQuery code.
Why Did The Library Decline?
If we talk about recent times, GitHub removed jQuery from their website’s front end, whereas Bootstrap v5 will drop jQuery. There are several reasons why jQuery was destined to fail in this era of coding, but mainly, there are two reasons for the library’s decline, and here we have listed both reasons briefly.
Browsers Have Become More Standardized
Though this might not be a significant reason for the decline of jQuery, standardization has improved. Now major browser vendors collaborate with the Web Hypertext Application Technology Working Group for web standards.
While the browsers are still different, the vendors now have some common grounds. In the present time, you wouldn’t need jQuery as it can be replaced with more convenient and efficient native code, and the APIs can do the magic for the developers.
Another reason for the decline is that now most browsers have an evergreen update strategy. Through this strategy, they can update themselves and are not tied to operating system updates.
Due to this strategy, users can adopt bug fixes and new functionalities much more quickly; meanwhile, developers don’t have to wait long before making the relevant changes according to the user’s feedback, as now they can use APIs and features without using jQuery.
There Are Newer, More Powerful Frameworks
Another reason for jQuery’s decline is the introduction of new and better frameworks. Some of the most valued frameworks currently available include React, Vue and Angular.
There are two significant advantages of using these frameworks over jQuery. First, they can break a UI into different components, making the development and updating process fast. It also ensures code reusability, making it easier to tackle complex websites.
Secondly, the newer frameworks also promote a declarative paradigm. Through this paradigm, the developer describes what a UI should look like and leaves the rest to the framework. This can’t be achieved with jQuery as the library requires explicit instructions on what to develop.
Overall, jQuery was a real warrior that lasted long in the early programming world. But fortunately, as time went by, things had to become more accessible for a programmer to comprehend. However, the library is still helpful in many different yet creative ways but only for simple web pages that won’t get complex.