Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I'm lately working on a few mobile web apps for Android (2.3+) and iOS (4+). Their browsers support most of ECMAScript5, which is very powerful, and I wanted to use language features where possible, resorting to jQuery only when I had to.

Turns out the only thing I use jQuery for is to have a shorter alternative for document.querySelectorAll. Might as well get rid of it.

If I only have to support modern WebKit browsers, is it a good idea to get rid of jQuery (and other general-purpose libraries)? They are a layer of indirection, after all.

(The apps don't have to make AJAX calls so far, I guess that's one thing that's going to get ugly. But is it worth keeping jQuery just for that?)

share|improve this question
Related: ;) For XHR, I'd suggest you this helper‌​. It doesn't answer you, but you get my point. –  Florian Margaine Jun 21 '12 at 9:40

3 Answers 3

up vote 8 down vote accepted

No, it doesn't make sense.

jQuery is a bloated library. Everybody knows that. And everybody uses it because it's one the rare cross-browser libraries out there that just work (note that I didn't say framework).

If you don't need support for legacy browsers, you don't need jQuery.

Small needs such as QSA shortcut or an XHR helper are thin. They are easily added through such objects.

Then, if you like its API, go for it. But it's not needed.

I can understand that some people prefer:

$( '.table' ).addClass( 'active' );

To (using By):

[] By.qsa( '.table' ), function( table ) {
    table.classList.add( 'active' );
} );

I find the second way more explicit, other will disagree. It's a matter of preference.

Also, if your code has any chance of being ported to legacy browsers later (or other non-webkit/sucky mobile browsers), use jQuery. It will reduce your headache later.


share|improve this answer
What if you have done this 25 times (not addClass x25 but there are a ton of other similar cases)? It gets harder and harder to read because there is just so much more code to be read. –  Esailija Jun 21 '12 at 10:13
I don't find it harder to read, I find it more explicit. Matter of preference. –  Florian Margaine Jun 21 '12 at 10:20
I feel that there are a lot of other reasons to use jQuery other than just support for legacy browsers. I disagree with the opinions of this answer which seem extremely subjective and based on preference rather than fact. –  Michael Durrant Jun 21 '12 at 12:47
@MichaelDurrant yes, jQuery usage of its API is extremely subjective and based on preference. Which is what I said in this answer. –  Florian Margaine Jun 21 '12 at 12:48
"Everybody knows that" - hmm, this seems to be discouraging counter-arguments. jQuery has lots of value: –  elias Jun 21 at 5:17

I think it's still worth using. jQuery effectively makes your code more compact and more readable, resulting in faster development and less maintenance (taking into account you have some experience with it).

If jQuery is too heavy-weight for you, you should give Zepto a try, which is kind of a light-weight alternative for jQuery (with a similar api).

share|improve this answer

I'd say, when you don't know what to do, just use jQuery.

jQuery has lots of value, handles edge-cases and avoid headaches for you:

Using jQuery is standing on the shoulders of giants.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.