What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 139 Stack Exchange communities.

How many JavaScript questions can be answered with "use jQuery"?

Looking at JavaScript questions, all too often the answer seems to be "use jQuery," sometimes in as few words. We can end up with answers which feel more like plugs getting the asker to try jQuery (the Silver Bullet) than a concise solution to their question.

Mind you, jQuery is dope (some might even say "sick" or "dyn-O-MITE!") and as such, "use jQuery" can be an effective solution to 9 out of 10 JavaScript problems.

But I feel strongly that it's not enough—as a web developer—to know jQuery and not understanding the underlying JavaScript. For example: A project I was on had a nifty widget to configure a web page, which made use of jQuery. When the Search Solution was integrated, however, it turned out that somehow the Search Solution conflicted (rather seriously) with jQuery and broke the widget. When faced with doing without the (expensive) Search Solution (which had been paid for) or the (free) jQuery library, the decision makers tasked me with refactoring the widget to work without jQuery. Obviously I couldn't have done it had my knowledge not gone "use jQuery."

Bearing all these in mind, at what point is "use jQuery" not an appropriate answer to a JavaScript question?

share|improve this question

closed as off-topic by gnat, senshin, Doorknob, Troyen, Robert Cartaino Jan 31 at 0:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – gnat, senshin, Doorknob, Troyen, Robert Cartaino
If this question can be reworded to fit the rules in the help center, please edit the question.

I see you're trying to determine when to use jQuery by analyzing the problem at hand and applying logic and reason to make an informed decision about its possible implementation. You should totally drop that and try jQuery. –  snicker Apr 1 '10 at 21:28
@snicker I see you're trying to convince someone to use jQuery. You should totally drop that and try jQuery. –  Earlz Apr 28 '10 at 23:43
Isn't jQuery passée now? I thought everyone was using the new EczemaScript. It's bundled with every browser and is, like, good for your skin too. –  Dan Diplo Apr 29 '10 at 8:40
You have to love the "I'd like to add two numbers together in JavaScript - Why, simply use jQuery..." style questions, if only for the "when all you have is a hammer, everything looks like a nail" syndrome. :-) –  middaparka Jan 21 '11 at 13:27
I agree completely. jQuery is great, but it seems like people lean on it a little too much now-a-days, without having a solid enough understanding of JavaScript. Take the crutch away, and many are left crippled. –  James Johnson Oct 3 '11 at 16:49
You might want to take a look at this question: stackoverflow.com/questions/471597/is-jquery-always-the-answer. –  Kibbee Oct 3 '11 at 19:26
Good luck getting jQuery to run on Node. JavaScript isn't just for browsers. –  Lee Kowalkowski Jan 24 '13 at 9:13
I'd like to see a without-jquery :-) –  Ben Collins Jan 18 '14 at 3:21
Well JQuery has a special plugin called javascript, you can use it to make more JQuery plugins, and that's all for it... basically a question tagged javascript and not jquery should answer javascript (although it might also provide a hint to Jquery, it is in fact like a question in assembly language and a answer in a higher language) –  yoel halb Jan 31 '14 at 1:47
When your writing JavaScript for IE3 because your stuck in a special kind of legacy hell only known to you and 3 others who have a token ring network with you. –  Jimmy Hoffa Feb 4 '14 at 16:52
I think this question is relevant beyond just SO, there are many SE sites dealing with both Javascript and jQuery. –  3ventic Apr 21 '14 at 23:03
Every time I see a useless-use-of-jQuery, I get a strong urge to vote to migrate the question to Super User. Does that count? Why do so many people feel the need to source 84kb or more of external libraries just to fire a function on document ready? Blows my mind. –  rojo Nov 24 '14 at 14:12
@Shog how exactly isn't this site specific? How is it a discussion about the whole network? If the official stance is leaving those open then please remove the "This question pertains only to a specific site" close reason since it's only a waste of time. –  Shadow Wizard Dec 30 '14 at 14:43
Please read meta.stackexchange.com/questions/242809/… @sha –  Shog9 Dec 30 '14 at 15:44

16 Answers 16

up vote 122 down vote accepted

Pretty much never.

For convenience, here's the image the above link points to:

spoof screenshot with a high-scoring jQuery answer and a downvoted legitimate answer

Given the URL and text in the image, I suspect this image was put together by our old regexinating pal bobince!

share|improve this answer
Link to his post: doxdesk.com/updates/2009.html#u20091116-zalgo –  Michael Stum Apr 29 '10 at 0:35
This is obviously misleading. The proper use of a + operator would be to sum the values of the values of two text boxes. Like so : var c =$("#a").val() + $("#b").val(); alert(c); –  user146643 Apr 29 '10 at 18:25
we have a possible contender!! stackoverflow.com/questions/11907653/… –  bPratik Aug 10 '12 at 19:03
I'm just wondering, which library OP finally have chosen for the job ; ). –  Teemu Apr 5 '14 at 19:29
Here's the new (and legitimate) version –  Random User Nov 4 '14 at 16:15
Did you guys see the new beta version of StackExchange running purely on jQuery? There's just a question box (users can't give answers), because all the answers are provided directly by jQuery! Can't wait for it to become a standard. –  Shomz Dec 25 '14 at 14:04
@user146643 That's incorrect, alert is part of the standard DOM, you should use a jQuery equivalent. –  Andrea Dec 27 '14 at 16:34

Probably when the answer "use jQuery" itself doesn't solve the question or problem at hand? At the end of the day jQuery itself is a framework solution that still requires some implementation details to really solve a problem.

If the op were to ask:

What JavaScript framework should I use for accordions and date pickers?

A valid answer may be:

You should take a look at jQuery and jQuery UI to handle this.

Outside of that... "use jQuery" doesn't really solve anything...

share|improve this answer
I see you are still fighting about "use qQuery" answers by replying to your own question.You should totally drop that and try jQuery. –  Ufuk Hacıoğulları Apr 2 '10 at 0:59
"use jQuery"; should just be part of ES Harmony like "use strict"; –  Jethro Larson Jan 6 '12 at 0:39

Obviously simply saying "use jQuery" doesn't solve anything it's self. But as a framework/library jQuery is designed to solve, or make simple, many common JavaScript problems. That's why people find it so useful and why the answer to so many of the JavaScript questions posted boil down to "use jQuery".

That being said it's not a replacement for understanding the JavaScript underneath.

There are places where jQuery has a bug, or you're trying to do something that isn't within the scope of jQuery, jQuery UI or any of the jQuery plugins then you're obviously going to need to write your own JavaScript. There are also things where for performance issues you won't want to use jQuery.

So really it depends on what the question is, but for the most common questions "use jQuery" is the answer, and that's kind of the point.

share|improve this answer

When you're trying to reboot the system to get the electric fences back on.

share|improve this answer
Seriously, even jQuery knows better than to shutdown the raptor fences. –  Craig Apr 29 '10 at 4:22
The reason I ask is that I'm told large javascript libraries, such as jQuery and protocol aren't born man-eaters. Is that true? These libraries must learn somewhere along the way that human beings are easy to kill. Only afterward do they become man-killers. So I wonder: have they learned, somewhere along the line, that human beings are easy to kill? –  Richard JP Le Guen May 21 '10 at 19:05

So my question is - bearing all these in mind - at what point is "use jQuery" not an appropriate answer to a javascript question?

A question which is not answerable with "Use jQuery" is not an appropriate question.

My answer is correct because my answer is correct.

share|improve this answer
Boy am I happy my boss left early, cause I am dying right now. –  Jeff Sep 18 '12 at 14:09
@Jeff are you alive? did your boss come back? it's been 2 years, and no word... did jQuery become the man-killer as the OP commented? –  kumar_harsh Feb 18 at 13:30
@kumar_harsh *contemplating on not replying to keep the illusion alive* –  Jeff Feb 18 at 13:36

Use MooTools or Dojo.

There, I said it.

share|improve this answer
I think you ment "Use jQuery", typo perhaps? –  saturation Mar 8 '11 at 12:24
$("answer").append("use jQuery when:always")
share|improve this answer

When any of the following is true:

  • It is the entire answer, with no explanation of exactly how jQuery helps
  • When the problem can be solved simply without jQuery
  • When the question specifically asks for no javascript frameworks
  • When the question is tagged or mentions a competing framework
  • When someone else already posted it
share|improve this answer

On JS-related questions which doesn't mention anything about jQuery, I usually just take it serious with a pure JS answer. Often when it concerns DOM manipulation, then I will post at end of my answer a subtle suggestion to have a look at jQuery --the OP might namely not be even aware of that; learning new things is always good--, eventually along some link to the specific jQuery function in question and/or a short, nice and encouraging example how it could be done in jQuery.

But oneliner answers (and even comments) in flavor of "Use jQuery" on those kind of questions gives me itch. A lot. I'm tempted to flag them as spam.

share|improve this answer

The only question to which the answer is not jQuery is "To what question is jQuery not an answer?"

Presto! Recursion.

share|improve this answer

JavaScript !== JQuery

JQuery is largely a replacement for the DOM. It provides a lot of tools for working with browser specific stuff, not JavaScript specific.

There's questions about JavaScript itself that can't be answered with "use JQuery". Questions about scope, the way functions work, objects, etc.

However, JQuery can be used beyond questions about JavaScript or the DOM. Just the other day a waitress asked "What would you like?" at a restaurant to which I replied "just use JQuery". She knew precisely what I wanted at that point

share|improve this answer
Don't you mean !==? ;) –  Skilldrick Sep 28 '10 at 10:46
@Skilldrick Gosh, this is old by now, but I originally had !== until someone edited it. They probably weren't used to JavaScript? –  Bob Nov 1 '11 at 0:46
@Bob: jQuery is largely a replacement for the DOM...? The wording could possibly cause someone to miss-interpret jQuery. jQuery does not replace the DOM but provides an API which simplifies the interaction with; and the manipulation of the DOM, makes Ajax calls easier and includes many other features, while working across multiple browsers. The one thing it does not do is replace the actual DOM. –  François Wahl Apr 9 '13 at 20:33
Don't you mean !$(JQuery).is(JavaScript) –  Adria Jan 30 at 16:13

It's unbelievable how people think about JavaScript and jQuery -- or how they don't think about JavaScript.

Particularly, I don't like jQuery and I would rarely recommend it to someone. jQuery has cool features and a bunch of plug-ins, but its philosophies make people answer questions like the above.

I like to write scripts in which I know exactly what I am doing, so I have total control over it. With jQuery/jQuery plug-ins, you usually -- not aways, of course -- write something that you at most have just a clue about what that does under the hoods. The reason? Philosophies. What about some customization? I'm tired of people coming to me asking how they customize the way that jQuery/jQuery plug-ins do stuff. My answer: "learn JavaScript".

share|improve this answer
Eh... Those who know JavaScript can read through the jQuery source fairly quickly. Those who don't still could, but probably won't because they want a magic box. See also: stackoverflow.com/questions/215589/… –  Shog9 Jul 20 '10 at 5:06
@Shog9 that's assuming they want to and have the time –  Michael Jan 30 at 17:27
If you don't want or have time to learn, then there's a limit to what any answer can do for you. –  Shog9 Jan 30 at 17:29

Yes, it saves loads of time and frustration. jQuery is great. I love jQuery. But here's personal experiences where I won't want "Use jQuery" as an answer:

  1. When I'm using Greasemonkey, jQuery doesn't work without an ugly workaround. Usually I don't want to bother.

  2. If a client's site already has another JS library in play (read: Prototype / Scriptaculous), running jQuery.noConflict() in tandem is a last resort; I've tried it before and all it causes is problems and confusion:

    So, this $ belongs to jQuery? No wait, Prototype. So why is all the Prototype stuff broken if jQuery's in noConflict mode? Why is Firebug reporting that $ is the jQuery object? Ok, now I have Prototype working, but some of the jQuery plugins are screwing up. [string of expletives from frustration]

    I've learned that the appropriate solution is to Google prototype [whatever I'm trying to do] example and I get by just fine. If that ever fails, I'll ask on StackOverflow.

  3. By the same token, when I'm freelancing on a client's web site, if the client is requesting animations and AJAX calls on a page, I'm going to use jQuery. But I'm not going to add the entire jQuery library to his page's overhead when all I need is document.getElementById("foo").

Don't get me wrong. I'm a huge supporter of jQuery. I author plugins, for God's sake. It's just that jQuery is only a subset of JavaScript. It's usually a great option, but not always the best option.

share|improve this answer

"Use jQuery" is not a valid answer to any javascript question starting "I was hacking on the internals of jQuery, and ..."

share|improve this answer

Any answer suggesting jQuery should still include the answer of the question using jQuery.

But in general, I hate answers that raise more questions. And the question is: why jQuery and not YUI.

...and when you write a Chrome-extension, did you know that it even has XPath?

share|improve this answer

In my opinion, "use jQuery" is not a valid answer any time the asker has not specifically asked about jQuery, and here's why. The user should have to opt-in to hearing about jQuery, not opt out.

Google is a great tool. Anybody interested in finding about about javascript libraries can easily do so, and there are a lot of great ones out there. But directing every question about how to do something into an answer about how to do it in your favorite library is redirecting what could be a good, general purpose answer that anybody could use, into one that is only useful by people who are able to use your library. Rampant evangelism notwithstanding, there are a lot of projects in which using jQuery is outside the scope and requirements of the project. The project might require using a different library or no library at all, and the library chosen if any might not factor into the wording of the problem. The user might simply be interested in knowing how to do it in plain javascript due to the fact that certain things are really hard or impossible to do properly unless you know what browser or even version of the browser or OS you are using. jQuery might abstract this away from you, but in certain cases this is undesirable, and I would argue it helps keep programmers complacent when they should be rising up and calling for better interoperability between browsers.

It seems like 90% of the time I am trying to find out how to do something in Javascript all the answers I find are how to do it in jQuery. As a result, I either have to dig into the jQuery source code (not gonna happen, I've tried it, and I just don't have the time) or ask my own question specifically requesting how to do it in plain javascript. Now I have wasted my time and everybody else's repeating a question that was already answered, but in such a way that it is not useful to me.

Having said that, if you feel the need to tell the user about jQuery, I have no problem with you supplementing your answer of how to do it in Javascript with how to do that in jQuery. Now you have not only educated the user how to do what they wanted in plain Javascript, but you have also shown them how much easier it is in jQuery, and they can make a more informed decision as to whether they want to start using it.

share|improve this answer
Solution: Rename jQuery to jAardvark. Stackexchange sorts labels alphabetically. Google weighs the first title word extremely heavily. Therefore all jQuery questions rank too high for JavaScript. –  Adria Jan 30 at 16:09

protected by Lance Roberts Aug 26 '11 at 15:29

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .