JavaScript Devs: Is It Still Worth Learning jQuery?
Nerval's Lobster writes: 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. But 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? Some developers don't think so. The official jQuery blog, meanwhile, is pushing a separate jQuery version for modern browsers, in an attempt to keep people involved. And there are still a few key reasons to keep learning jQuery: 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: People still like jQuery and its elegance, and they're going to continue using it, even though they might not have to.
I hear great things about that new-fangled VanillaJS framework. Very lightweight and fast, and already more popular than jQuery.
Socialism: a lie told by totalitarians and believed by fools.
jquery makes an absolute mess out of javascript. Much of it involves DOM manipulation, which is something you generally want to avoid doing as much as possible. It's a pain in the ass to read, has a nasty learning curve, and it's slow as fk. Don't bother, unless you need to operate on existing jquery code, or have some other very specific reason to use it or interact with code that uses it.
"Champagne for my real friends - and real pain for my sham friends!" http://ericblade.postalboard.com/
No. jQuery is bloated by their desire to make sure your pages are compatible with ancient Microsoft browsers.
Also, jQuery allows developers to be very lazy. Example: Many sites bring back JavaScript in their AJAX returns. Did you know that jQuery uses EVAL to process any JavaScript returned via AJAX?
jQuery UI is a horrendous memory and performance hog. There are billions of JavaScript code examples to perform the individual functions of jQueryUI without forcing your customers to download that monster.
Don't be lazy.
Some things need to be said...
A site may wish to continue using JQuery because some of its clients are using older browsers that don't support the new features that allegedly obsolete JQuery code.
Drop the JQuery code and you drop those customers. Develop future code without it and the pages with the new features won't perform with people using legacy browsers. And so on.
I've seen similar things happen over several generations of web technology. Use care, grasshopper!
Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
I always used it like "fuck it, I'm lazy, lets go"
That is, If you like frameworks that are bug free, extensively tested, universally known and hide a lot of the weirdness between browsers and browser versions providing a consistent interface, then yes, definitely learn it, it takes a lot of pain away.
If you like pain, or always want to use the shinny new fancy thing, or want to learn all about IE9 and Opera edge cases. Then don't use it.
So yes you need it to do the stuff that SharePoint doesn't do.
I've been using Javascript for 15+ years and never seen the reason to learn jQuery.
It's not really old vs young. Most of those on older browsers are coming from foreign (non-USA) countries or are coming from corporate networks where they don't have control over what browser they are running.
But can you give me an example of jQuery creating a terrible mobile experience? In my experience, I haven't noticed any issues on mobile devices for websites using jQuery.
I don't know that I'd start a new project in it, but jQuery has permeated the web to such a degree that I don't know if you *can* be a front-end web without being vaguely aware of it. It's worth *knowing about* but there isn't much to *learn* about it. It's a library for "querying" the DOM the way you do in CSS; that's why it became popular -- that particular task used to be difficult, even though now it's part of the DOM. I still use it for Ajax requests, mainly because the syntax is easier for me to remember than native JS. But most of what jQuery made easy is already easy in bleeding-edge browsers and frameworks. The rest - promises, events, animations, ajax - are sort of "helper fluff" that are also better done in other libraries, or native JS/CSS at this point.
TL;DR - Yes, you should learn it, but don't go out of your way to focus on it. If you understand modern JS & DOM techniques, then you'll be able to figure out jQuery easily when the day comes that you need to debug/modify/replace it.
As long as the web is used to publish extremely complex apps that should not be on the web, yes. Web is for video playback, reading news and blogs, Business app?, desktop, using web services.
JQuery as a framework is, frankly an utter joke. However, as a utility library it's invaluable. Learn Angular, React, or some other modern framework, and lean on JQuery for things those frameworks don't do. Simple example: Ever try to submit a from from an AngularJS controller? Yeah, not doable. Add 2 lines of jQuery? Done! So yes, learn it, and use it where it fits.
JQuery is just encapsulating some primarily dom-related javascript mainpulation routines with the added bonus that they try to eliminate browser differences. So, when you're saying that the browser provides features that jquery was needed for, you're really saying that the browser does things that javascript is no longer needed for.
I'm just not seeing it though. With pure HTML & CSS and a fancy new browser, can I:
Write ajax requests and parse and conditionally apply the results to various page elements?
Dynamically add and remove elements?
Perform liquid resizing based on a layout approach with glue elements and fixed-but-scalable areas - that is dependent upon the size of other elements rather than explicit browser viewport height/width?
How about perform custom input box validation?
Maybe set the value of a text box only when a value in a linked select box is changed?
Pop up a dialog when a button is clicked?
Start an image upload when you drag an image over a browser region?
In the age of ever-closer-to-desktop-application websites, I'm only seeing more and more use of javascript frameworks - of which jquery is one - and frankly I don't see how anyone could do without it. Maybe if you're making static brochure sites, I suppose, but then you weren't using javascript for that anyway.
Maybe the original poster meant to say "is it worth learning jquery instead of another framework or library" ? Otherwise I can't see anyone who actually creates web applications for a living even asking this.
It takes like 5 minutes to learn to use Jquery, it is used in 90% of all current websites, and is still one of the best if not the best library for dynamic DOM manipulation and has incredibly easy to use ajax requests. I cannot imagine creating a dynamic website without it.
Troll is not a replacement for I disagree.
In my experience, I haven't noticed any issues on mobile devices for websites using jQuery.
I can list of plenty of mobile websites with horrible experiences that use jQuery.
But I would not say jQuery itself is the reason for that.
jQuery itself is not inherently a problem. It can be leveraged to do many memory-hungry and processing-heavy actions that break mobile browsers, but that's not jQuery's fault. People can make memory-hungry and processing-heavy PC-centric websites using many different tools.
//TODO: Think of witty sig statement
$20 and I'll turn off my regression suite that checks if your site is still IE6 compatible.
Suborbital [spaceflight] is the special olympics of spaceflight. - Rei
When you load a javascript library the browser has to allocate memory to every function in the library even if they are never used and most web sites are using dozens of javascript libraries. While this is ok on a desktop, on a tablet - which has much less memory - it means you only have enough memory to have one web page open at a time. Some web pages are so infested with javascript libraries they cause the tablet browser to crash. And they are just displaying static text and images, something that doesn't require javascript.
Simple example: Ever try to submit a from from an AngularJS controller? Yeah, not doable. Add 2 lines of jQuery? Done! So yes, learn it, and use it where it fits.
If you're not able to submit a form in Angular you're not using the framework correctly.
Remember, there are no stupid questions. But there are a lot of inquisitive idiots.
I saw a very insightful & funny talk on this subject last year. The very clever Josh Broton lays out exactly why jQuery has become an excuse not to do it right the first time. Basically it comes down to this:
A few facts about latency and user behavior: "...250 milliseconds can be the difference between a return customer and an abandoned checkout cart." "...every 100 milliseconds of latency resulted in a 1% loss of sales." "...lose 20% of their traffic for each additional 100 milliseconds it takes a page to load."
The average overhead jQuery adds to a website: "... add roughly 150ms to 1 full second of load time..."
He goes into many other good reasons too, it's well worth a read.
Slide here: https://github.com/joshbroton/...
Instead of throwing many small fragments at the browser and stealing user cycles to cobble it all together, just serve up the content already.
I have served the document. Now the user has activated a control to expand details of a particular part of the document. How should this click be processed?
Or I have served the document. Now the user has opted into real-time updates of part of the document. How should these updates be served?
but when your "users" are more properly called "customers" -- or even more important, "potential customers" -- then some web dev's desire to preach the gospel must take a back seat to doing the job the way it needs to be done, rightly or wrongly.
There are customers you want, and customers you ought to fire. Users of Internet Explorer before version 9 are probably using Windows XP, an operating system that cannot run IE 9. This means they're less likely to spend money on replacing a decade-old unsupported system with known security vulnerabilities. This in turn means they're less likely to have disposable income to buy your product. It also means they're less likely to care about the security of the payment information with which they buy your product, which can lead to an increased rate of chargebacks.