20 AnswersNew Answer
Galileo Is your project using ASP.NET WebForms or ASP.NET MVC? I should further qualify something about my last set of responses. Along with not using jQuery, I also almost exclusively implement frontend using SPA libraries / frameworks with a RESTful API. In that sense, I also avoid using server side dynamic HTML platforms. Instead, I would use ASP.NET MVC WebAPI or NodeJS on the server side with ReactJS or Angular or maybe even VueJS on the frontend. I'm not opposed to other frameworks, but, there are my preferred choices at the moment. That said, if you are working on any existing projects already using jQuery, then, by all means, keep using jQuery. I would just avoid using jQuery on net new projects moving foward. I hope this information is helpful.
Ore Adeleye Regarding your points below: ---- "So when should you use jQuery. 1. You are making a large-scale app and you want to cut down on development time as much as possible. 2. You are making a web app that needs a lot of modern features that should degrade gracefully in old browsers. 3. Your gut tells you that jQuery is the right tool for the project." ---- My responses to each item: Um... no, and no, and awe hellz to the no. 😂😜 (I hope you read my silliness in this part) 😉 Seriously though... 1. jQuery on large scale apps is a recipe for disaster. I would avoid jQuery on anything new and certainly large scale at all possible costs. 2. I'd recommend using polyfills to support old browsers and if necessary, Babel to transpile down to ES5. 3. If the strongest argument for using jQuery comes from your gut, try taking some Pepto Bismo to treat that upset stomach and stick with the modern JS alternatives. 😉 None of those cases would ever be good for using jQuery. 👌
[Why I avoid jQuery: Part 1 of 3] Apologies in advanced for the detailed 3 part response. I hope it's helpful to anyone curious about why I avoid jQuery on new projects moving forward. Ore Adeleye Fortunately, polyfills are now so much easier to implement with core-js modules in webpack. So... there isn't any reinventing the wheel. 😉 For me, the issue with jQuery isn't about the size of the library file. Don't get me wrong... jQuery was a godsend during the dark ages of ES3 and craptastic browser incompatibilities. I've been working with jQuery since late 2007 / early 2008 and have implemented some amazing code with it. However, each year since browsers began to fully support ES6, jQuery has become overshadowed by much more preferred alternatives that have since revealed the many shortcomings of jQuery. I'll try to list a few of the challenges that make jQuery less than ideal for me to use anymore. Simply put, it's not needed like it once was with modern browsers being so compatible. (continued...)
[Why I avoid jQuery: Part 2 of 3] jQuery's greatest strength is how easy it makes traversing and manipulating the DOM from anywhere in the code. It's so easy to bind events to anything from multiple places. This is also it's greatest weakness. As a project grows in size and complexity, so does the jQuery code. It inevitably becomes a nightmare of spaghetti code that's difficult to maintain and keep under control. To be fair, it's not so much jQuery as it is the two way data binding, which was common in most other libraries prior to ReactJS. But, that's for another topic. Over the years, I would experiment with several different conventions and practices in an attempt to keep the code well structured, modularized, and testable. However, jQuery makes it so easy to do what you want, where you want, whenever you want. It's really difficult to keep consistency over time and across different developers with a standardized and centralized approach for binding events and searching DOM nodes. (continued...)
David Carroll as regards your second point. Do you really prefer writing polyfills for old browsers instead of leveraging an already developed library that does that? To me that's like re-inventing the wheel. Let's face it jQuery is not that heavy. It's like 20kb gzipped. I think that is fine in some situations.
David Carroll I totally agree , I am also learning react knowing it is great . once learn vanilla js , jquery automatically comes in handy . I learn it doing small projects
Yes. Of course. jQuery is worth learning but it won't be ideal for small applications. If all you need in jQuery is easy dom manipulation, try UmbrellaJS. If you are using jQuery just because of Bootstrap. May be you should switch to Pure. If you are using it because of ajax. It is not worth it. Just use the fetch promise-based API. If you are using it because of animation. Please just use css. Visit https://animista.net If you are still confused check this http://vanilla-js.com/ jQuery is a great library but unfortunately most of the features it was awed for can now be easily done with pure js. So when should you use jQuery. 1. You are making a large-scale app and you want to cut down on development time as much as possible. 2. You are making a web app that needs a lot of modern features that should degrade gracefully in old browsers. 3. Your gut tells you that jQuery is the right tool for the project.
anjit pariyar Do yourself a favor and force yourself to breakfree of the jQuery plugins. Find alternative variants of the same plugins. Otherwise, you'll be stuck supporting plugins that have become long abandoned by their project owners. Trust me... it's no fun. Also, trying to support ReactJS + jQuery is also difficult with attempting to write unit tests. Just skip it. That's my advise. 😉
Hello, I would recommend having a read of this article: https://flaviocopes.com/jquery/ "Should you use or learn jQuery in 2020?" Thanks, TheCoder
David Carroll That's very insightful! I gained a lot. About the interview part, don't worry, there are a lot of legacy code in jquery that need help. jQuery developers can't be out of job so soon. Also, another situation where I think jQuery comes in handy is when a backend developer wants his site to look great without much frontend knowledge. But for most other situations, there are better options.
anjit pariyar I'm so glad you put it like that. Thanks for sharing your experience. 👌 I guess I should further qualify that if you are able to learn these things with ease, then by all means learn jQuery as yet another skill to have under your belt. However, don't allow yourself to make it the core skill for development.
Thanks all for your helpful answers! David Carroll, Ore Adeleye I actually have been learning pure JS, but my friend who works with me in a project, uses a lot of JQuery. The project is quite big and we develop with ASP .NET, C#, JS, HTML5, CSS.
David Carroll thanks for the answers! I learnt a lot from them. They were like a tutorial:) The project is using WebForms
Galileo I am eager to see David Carroll response to that.
Even upcoming bootstrap 5 is going to remove it . but there are so much plugins out there of Jquery so its okey to learn, it won't take long
jQuery is probably the most effective librarie for js