What are some of the pros and cons of using jQuery? [closed] What are some of the pros and cons of using jQuery? [closed] asp.net asp.net

What are some of the pros and cons of using jQuery? [closed]


The great thing about libraries like jQuery and Prototype is that they take care of a lot of the cross-browser kwirks that can make Javascript such a pain to write. Either one of those or maybe even mootools will be good to you, their respective websites being about as good as a resource as it's gonna get.

edit: as far as the 'con' of having extra loading size on your page, I suggest using Google to host these for you. Optimistically, some people will have it cached from other websites, plus Google takes care of versions/compression for you.


Pros: jQuery is a great library which lets you get what you want done in much much much less code, with a lot less hassle. The plugin architecture is incredibly simple, and the community producing plugins is very strong and active. If you can think "wouldn't it be nice if I could..." then chances are there's a plugin for it.

Cons: You are being abstracted away from the raw Javascript. Don't underestimate the effect of this "con". Though working in vanilla JS (that is, javascript without libraries), can be a massive pain, it gives you a much better understanding of what you're actually doing. You might find that your jQuery based solutions could actually be done in vanilla JS with a lot less overhead.


Pros: you don't have to deal with the tangled mess that is cross-platform Javascript compatibility. You don't have to worry about which browsers support standard event handlers and which have their own event systems. You don't have to write two hundred lines of DOM manipulation withHugeLongFunctionNamesFromHell to get nice dynamic pages.

Cons: It's an extra 15KB of code your users have to download the first time they load your page.