Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Should I use prototype.js or jQuery for a new project? Rails comes with prototype.js but jQuery seems the library of choice for the rest of the world. Is prototype.js still under active development? It seems a little bit dusty ...

share|improve this question

9 Answers 9

up vote 6 down vote accepted

It's mostly a matter of preference. Some people don't like how Prototype extends objects, but for basic use they are fairly equivalent.

Prototype is still in active development - they put out a release candidate for the next release just a couple months ago.

share|improve this answer

Use whichever one fits your specifications the best. jQuery is a great library under active development with a great (and large) community following and is my personal library of choice, but don't let that deter you from using Prototype if it is the right tool for the job.

share|improve this answer

It's really a matter of preference. I tend towards jQuery, personally. It's well documented, has lots of good plugins, and makes my life a whole lot easier. I've heard some complaints from the Prototype people about its size and performance (sorry, I don't remember their specific problem) but both of those aspects have been getting better and better.

I would try both out and see which one is a better fit for you.

share|improve this answer

Nothing against prototype but it does not have the amount of plug-ins or nearly as large of a community as jQuery does.

For jQuery there is already a plug-in for almost anything, so I end up writing a lot less js.

share|improve this answer

I believe jQuery hosted via Google CDN opens up both.

share|improve this answer

It is a matter of preference obviously. I have found jquery is a little but more difficult to understand for newbies since the chaining is not really intuitive in particular when asynchronous race conditions occur. However, jquery certainly has more plugins but that can also be a disadvantage when too many plugins are automatically loaded.

share|improve this answer

It really depends on which you prefer. However, jQuery does seem to have a bigger following, so resources for that might be easy to come by.

I think you can get both hosted from Google's servers, and jQuery hosted from MS's servers, which may come into your consideration.

share|improve this answer

While on the surface it's based on your preference, consider looking at the libraries, plugins, and samples of things that you want to use jQuery or Prototype to accomplish. For example, with a new Rails project all AJAX is done using prototype by default. Also if you want to use jQuery UI or jQTouch (mobile) I would recommend jQuery.

share|improve this answer

The reasons I use jQuery over any other library:

Fast and Lightweight
jQuery continues to increase the performance of their library even in of minor-revision-level releases. When they released 1.4.2, the speed of the library was greatly increased even from 1.4.1, as shown in an Ajaxian blog post regarding its release. Performance analysis of 1.4 compared to 1.3 was done by the jQuery team in the release announcement for 1.4, showing that 1.4 had been heavily optimized in the areas of its most frequent use and that performance had also increased across the board.

Popular
jQuery is served by 48 of the top 2000 websites in the Alexa directory, compared to Prototype's 6, MooTools's 3, and Dojo's 1.

Built With's Javascript Distrobution indicate that jQuery is used by over 40% of their indexed sites. Built With's jQuery Usage Statistics show 32% of the Top 10,000 sites, 23% of the top 100,000 sites, and 15% of the top 1,000,000 sites in their index using jQuery. Compare this to Prototype's 5%, 4%, and 2% respectively in those categories. Also notice that while jQuery's usages are all trending steadily upward, Prototype's usages are all trending downward.

Actively (and Intelligently) Developed
In March, jQuery posted on its blog Microsoft to Expand its Collaboration with the jQuery Community. From the post:

The jQuery Project is excited to announce that Microsoft is expanding its support of the jQuery JavaScript Library through new initiatives, to include code contributions, product integration, and the allocation of additional resources.

...

Microsoft will also ship a current release of the jQuery JavaScript Library in both Visual Studio 2010 and ASP.NET MVC as well as continue to host current versions of the library on the Microsoft CDN.

Microsoft is now included in the community of active contributors to the jQuery codebase. Microsoft has some very smart developers. Microsoft also financially contributes to jQuery. Microsoft has a lot of money. They are also giving jQuery instant exposure to any developer with Visual Studio. Microsoft is also working on ASP.NET to specifically make jQuery's integration better:

Also learn how ASP.NET AJAX was designed to work seamlessly with jQuery, how you can create ASP.NET AJAX controls directly from jQuery and how you can use the jQuery library in ASP.NET AJAX code.

More on Microsoft's use of jQuery can be found in Scott Guthrie's ASP.NET blog post jQuery and Microsoft.

jQuery's source code is hosted publicly on GitHub. This is a plus for me personally since I prefer Git to other SCM systems.

jQuery's Sizzle selector engine is great. And it's great because jQuery isn't working on it alone. In a blog post announcing the release of v1.3 early last year, they basically said "We know we're not smarter than everybody else and we're more interested in advancing the community by working with smart people than in saying we're better than they are."

One thing that became very obvious during the development of the new engine: We wanted to be able to collaborate on it with other libraries and developers. We saw an opportunity for some solid collaboration with some of the best JavaScript developers - the result of which will help users of all libraries. For this reason we made sure that Sizzle was able to work completely standalone (no dependencies).

Additionally, as a sign of good faith and willingness to collaborate, we've released the source code to Sizzle to the Dojo Foundation. We wanted a common meeting ground where everyone would be able to work together and under which there would be a clear long-term copyright holder.

Right now we're working with Prototype, Dojo, Yahoo UI, MochiKit, and TinyMCE (and many others) on Sizzle, honing it to perfection.

Mobile Support
In the YayQuery podcast, Episode 18 (mp3), John Resign outlines the plans for jQuery's mobile support. The philosophy is that the primary jQuery library should be compatible with mobile devices, instead of writing a dedicated mobile version. One of the many benefits of this is that as your primary library is used on general as well as mobile websites, it is more likely to become cached, and mobile-specific websites can use the same cached version as non-mobile websites. John also explains exactly which phones and operating systems are planned for support.

jQuery can be used with PhoneGap to create native applications using web technologies for mobile devices. It also has a plugin named JQTouch for building native-like web apps for the iPhone and other mobile browsers. This means all those shortcuts you have with jQuery translate to other platforms, decreasing the learning curve.

Active in the Development Community
John Resig is an active speaker. He includes not only major conferences and events but has also appeared on podcasts like YayQuery. He has also written two books: Javascript Ninja and Pro Javascript, both about pure Javascript skills not dedicated jQuery.

share|improve this answer

Your Answer

 
discard

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.