Changing jsFiddle's Default Library to jQuery

- - | Comments

jsFiddle is awesome and I can’t say it enough. It has become the de facto mechanism to share snippets of javascript/html/css on the web, and I love that it’s so easy to use. It’s the fastest way to try out a new idea, show someone else a problem that you’re having, or just spend some time playing. I’m really grateful to Piotr Zalewa for spending so much time in making it such a great tool.

Since I use jsFiddle so much, I’m bound to find an annoyance or two though. I have found that I very often forget to switch away from the default js library, MooTools. It’s starting to become muscle memory that every time I open, I immediately change to jQuery, but it’s not quite there yet. Not only me, but many people asking for help on freenode have the same problem. About once a day someone posts a jsfiddle link to #jquery asking why something doesn’t work, and the code looks correct, except for the library chosen on the right side.

Until yesterday, I had always assumed that this default was alphabetic. I never paid attention to the fact that M was after D in the alphabet, so Dojo should have been first with jQuery somewhere in the middle. I found out that it’s actually ordered by Piotr’s preference, and he’s actually a MooTools core developer. Also, jsFiddle is actually built on top of MooTools and Django, so it makes sense to keep that as the default.

I just wrote a chrome userscript that can be used to change the default setting to jQuery. This can be easily modified to pick your favorite, or most commonly used library. I wrote it in MooTools out of honor and respect to Piotr, and because I figured it’d be fun to learn some MooTools.

If anyone would like to add a greasemonkey version of this, just let me know and I’ll add it to the gist.