Write less, do more
January 14, 2010 1:02 PM   Subscribe

January 14th marks the 4th birthday of jQuery and also the release of jQuery 1.4. To celebrate the release of the latest version of the popular JavaScript library the jQuery team has created the 14 Days of jQuery site, which will be updated each day with a new announcement or release. There’s also prizes to be had for the coolest use of jQuery.
posted by Artw (44 comments total) 19 users marked this as a favorite
 
PAAAR-TAY! WOO! PAAAR-TAY! I'M GONNA HAVE A GEEK PAAAR-TAY! no. seriously. gonna read the docs on my iPhone tonight over a root beer and cheese fries.
posted by ardgedee at 1:15 PM on January 14, 2010


When I first started web programming I had to decide between jQuery and Prototype and I ended up going with Prototype. I couldn't tell you why.

I'd love to make the switch to jQuery, but I don't want to spend the time rewriting thousands of lines of Javascript.

The lesson: always choose and research your frameworks thoroughly!
posted by christonabike at 1:16 PM on January 14, 2010 [2 favorites]


Man, I loves me some jQuery.

There are some nice additions in this version, particularly the normalization of change/submit events in IE to act like every other browser. I also like that .live() supports (almost) all event types now, instead of a select few. Coincidentally, both of these are things that I had to write a bunch of code last week to work around...

On preview: Actually, I started out using Prototype.js as well. (later switching to YUI which was more of a widget library at the time, then finally to jQuery) Prototype taught me a lot about the way JavaScript really worked (closures, anonymous functions, etc), knowledge that serves me well to this day and made transitioning between frameworks surprisingly easy. Give jQuery a try, it's not that hard to pick up.
posted by The Lurkers Support Me in Email at 1:22 PM on January 14, 2010


does jQuery have anything to do with jRun?

you know why i'm asking.
posted by shmegegge at 1:23 PM on January 14, 2010


Do people still abuse themselves by using prototype.js?
posted by xmutex at 1:28 PM on January 14, 2010


I still need to learn that some day.
posted by delmoi at 1:31 PM on January 14, 2010


xmutex: "prototype.js?"

good god, that seems like a million billion years ago.
posted by boo_radley at 1:33 PM on January 14, 2010


I'd love to make the switch to jQuery, but I don't want to spend the time rewriting thousands of lines of Javascript.

I made the same switch; I think a lot of developers latched onto prototype early and have been gradually switching over. Do it. It's worth it.

(But hey, if you don't, at least you're not stuck with the active suck that is YUI *shudder*.)
posted by ook at 1:33 PM on January 14, 2010


Created by MeFi's own jeresig, I believe.
posted by kwaller at 1:35 PM on January 14, 2010


Also, there's a live Q&A session going on right now.
posted by The Lurkers Support Me in Email at 1:43 PM on January 14, 2010


I love jQuery - as a designer and non-programmer, jQuery makes doing cool little tricks way easy.
posted by OverlappingElvis at 1:44 PM on January 14, 2010


Coincidentally, I just used jQuery last night for the first time on a Drupal site where the customer wanted some content on a static page hidden until someone exposed it by clicking 'display more'. When I implemented a simple toggle to switch the display from block to none and back, they said "that's great, but could you make it slide open instead?"

Once the veil of red, red rage had cleared from my eyes, I agreed to look into it, and ended up grabbing jQuery and solving that particular demand with two more lines of Javascript. Now it's actually on my list of things to learn without waiting for a client to pay me to learn it.
posted by fatbird at 1:45 PM on January 14, 2010 [2 favorites]


I've not amde any substantial use of any other libraries, so it's hard for me to mkwe useful comparisons, but i will say this about jQuery:

1) My god has it made my life easier. Writing JavaScript with it is a joy, and it's difficult to imagine going back, especially given how much in the way of cross browser hassles it eliminates. And the techniques I've picked up using it have actually improved the way I code JS when I'm not doing anything jQueryish as well.

2) The documentation is awesome. As I say, I'm not in a position to do a grand comparison of all JS libraries, and in many ways they all seem to do the same thing, with $() being so common and all, but it's just so easy to learn how to do things in jQuery and that's one of the reasons I think people are settling on it - they really go the extra mile with that.

3) It's not particularly padded out with needless flashy stuff. At the same time there's jQuery.UI, which is itself pretty useful.
posted by Artw at 1:49 PM on January 14, 2010


I also started out with Prototype, mostly to support script.acul.ous, moved to jQuery about 2 years ago, haven't looked back. It's indispensable.
posted by mkultra at 1:54 PM on January 14, 2010


Once the veil of red, red rage had cleared from my eyes, I agreed to look into it

Kind of a programmer's motto, there.
Optionally, replace the "I agreed to look into it" with "I said no"
posted by mrnutty at 1:55 PM on January 14, 2010 [4 favorites]


Once the veil of red, red rage had cleared from my eyes, I agreed to look into it

I will say that the ease with which you can do some things is kind of dangerous, and if you give in to temptation your site can end up a horrid mass of blinking sliding twirling fading things... and ifg you look into plugins or jQuery.Ui there are even more things there that are initially very tempting and cool but which you should use with restraint. God help you if you work with some kind of non-coding design or UX department and they find out about the jQuery UI demos - you'll end up with everything on the page dragable, snappable, expandable and sortable whether it needs to be or not.
posted by Artw at 2:01 PM on January 14, 2010


jQuery has really made its own style of Javascript pretty indispensible for working with anything on the web (in fact, I'm coding up something right now that uses it..). It seems like the only other frameworks which are taking off are ones that cater to different markets (XUI is awesome), and higher-level frameworks (like Raphael).
posted by tmcw at 2:02 PM on January 14, 2010


Writing JavaScript with it is a joy, and it's difficult to imagine going back, especially given how much in the way of cross browser hassles it eliminates.

Oh hell yes on the cross browser compatibility issues. Having to sometimes write JS three different ways to work on three different browsers was enough to make me avoid coding in JS for many, many years. Being able to write it once in jQuery saved a lot of hassle.

Now, if I could actually learn how to effectively use jQuery's chaining functions, I could actually say I know this stuff.
posted by dw at 2:05 PM on January 14, 2010


$(this).
posted by fatbaq at 2:13 PM on January 14, 2010 [13 favorites]


fatbird: "Once the veil of red, red rage had cleared from my eyes, I agreed to look into it, and ended up grabbing jQuery and solving that particular demand with two more lines of Javascript. Now it's actually on my list of things to learn without waiting for a client to pay me to learn it."

Way back in the dark ages of 1.1, it was a similar experience that led me to learning jQuery as well. It's how easy? That's it? So the .js is a meg, right? It's how small?
posted by Plutor at 2:14 PM on January 14, 2010


Cross-browser compatibility is indeed why I pretty much use jQuery to mortar together my fancy stuff. I'm so glad someone else solved that problem in such a nice way.
posted by Jubal Kessler at 2:15 PM on January 14, 2010


Plutor: So the .js is a meg, right?

jQuery is about 150k. Minified, it's about 25k.

Bonus, you can have Google serve your jQuery for you from their CDN:

http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.js
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
posted by mkultra at 2:25 PM on January 14, 2010 [4 favorites]


mkultra, plutor's comments were rhetorical.
posted by boo_radley at 2:32 PM on January 14, 2010


> Bonus, you can have Google serve your jQuery for you from their CDN:

One of the more delightful hidden benefits of that is that as more sites depend on the Google-hosted jQuery library, the fewer copies of jQuery any browser has to load and cache, and the more likely the browser will still have a valid copy of jQuery in cache when visiting any arbitrary site that depends on the Google-hosted lib.

Net effect: One less file to load from your site, and a little less wait before your Javascript can execute.
posted by ardgedee at 2:34 PM on January 14, 2010 [1 favorite]


well, maybe not rhetorical, but half of a dialogue.
Anyway, jquery is great, jeresig is one of the few people I'm jealous of, etc, etc.
posted by boo_radley at 2:41 PM on January 14, 2010


Supplemental tidbit: If you don't trust Google to host your JS for you, you can instead put your trust in Microsoft's CDN! Oh god, that felt so wrong.
posted by The Lurkers Support Me in Email at 2:44 PM on January 14, 2010


Looking forward to trying this out. jQuery combined with the variety of developer-oriented Firefox extensions out there (Firebug in particular) makes my job so much easier it feels like I'm cheating.
posted by evisceratordeath at 2:46 PM on January 14, 2010 [2 favorites]


I am here to tell you: the jQuery launch is more important for the web than the Windows 7 launch. That statement is not snark, hyperbole, or any sort of exaggeration. Inlining a function into the DOM manipulation functions (css, attr, val, text, etc) is a massive, massive step forward.
posted by mark242 at 2:52 PM on January 14, 2010 [1 favorite]


$('.article:eq(88320)').focus(function(){
   $(this).find('.comments').each(function(){
      if($(this).hasClass('awesome')) alert('I like this comment');
      else alert('This comment sucks!');
   });
});
posted by bjork24 at 3:08 PM on January 14, 2010


Supplemental tidbit: If you don't trust Google to host your JS for you, you can instead put your trust in Microsoft's CDN! Oh god, that felt so wrong.

...and you've just reminded me of AJAX .NET, which is a horror. MS seem pretty big on jQuery these days, but their own code library for AJAX is nasty and a pain in the ass. Plus it revolves around their AJAX controls, which are mess of horrible things like the update panel.

ASP.NET MVC is pretty awesome though. And completely free of the ASP.NET control architecture. The sites I'm working on used to use a little bit of the AJAX .Net JS but we've stripped it out and replaced it with pure jQuery and it's been a lot better to work with since.
posted by Artw at 3:09 PM on January 14, 2010 [1 favorite]


I'm the hackiest of half-assed dilettantes when it comes to javascript, even though I've been an enthusiastic amateur codemonkey for like 35 years, but I like me some JQuery. I'm also pleased that one of the competing libraries seems to be edging closer to being a standard, which was probably inevitable, but man, it's been a while.
posted by stavrosthewonderchicken at 3:53 PM on January 14, 2010 [1 favorite]


Saw Resig speak at Yahoo! about a month ago on testing in Javascript. I was really impressed with the discussion of some of aspects of the testing setup they'd developed for jQuery; if that talk was any indication, they treat it as a serious software engineering project.
posted by weston at 4:36 PM on January 14, 2010


I gotta say that jQuery (and Django and Blueprint CSS) provide me with a living wage, allow me to never have to say to a client "sorry, you can't do that", and make coding the part of my work that I most look forward to.
posted by signal at 5:03 PM on January 14, 2010


I'd love to make the switch to jQuery, but I don't want to spend the time rewriting thousands of lines of Javascript.

You don't have to rewrite anything. Just switch to JQuery for all your new code. Look up the noconflict() method. This is how thoughtfully JQuery is designed.
posted by srboisvert at 5:05 PM on January 14, 2010 [1 favorite]


ASP.NET MVC is pretty awesome though.

Hey I'm working on an ASP.NET MVC project, how do you use your javascript? I've been trying to make heavy use of javascript and haven't figure out how to do it in a dry manner. Basically I'll have everything nice and clean and end up redoing a lot of code in the view, in javascript. I've made some use of the T4 templates, but haven't really figured out how to make it pretty. It seems as if I define my model in the model layer I shouldn't have to define my model in javascript. I'd really like to use Closure/ExtJS, but they just don't seem suited for the ASP.NET MVC development workflow?
posted by geoff. at 6:18 PM on January 14, 2010


Anyone know of a good updated cheat sheet? I've been using this one, (although it was outdated even before 1.4 came out) because I liked the format so much.
posted by jsmith77 at 6:20 PM on January 14, 2010


See also yayQuery, the jQuery podcast.
posted by Partial Law at 6:42 AM on January 15, 2010


I also love jQuery. We use some 3rd party ASP.NET controls here, and one is a ribbon thingy that lets you scroll through images. I had a request to have a checkbox below each one but the control didn't expose a way to do this. Using a little ASP.NET plus jQuery and one of its plug-ins, I was able to build something that looked just like the control but with checkboxes, totally from scratch, in just a couple of days. Scrolls nicely, images fade in, fast ... as often with jQuery, I was left thinking "Wow, I did that? Shouldn't that have been harder? I didn't think I was that good a web programmer!"
posted by freecellwizard at 7:30 AM on January 15, 2010


jQuery 1.4 API Cheat Sheet
posted by Artw at 8:12 AM on January 15, 2010


geoff. - haven't really done anything like that - mostly we just try and make sure that our views have good, clean HTML and write our JS accordingly, without particular reference to what the server side code is doing. We do however make extensive use of serialisation to JSON and , which makes AJAX super easy, and means that theres similarities in data structure and tend to be consistant across client and server side.
posted by Artw at 8:37 AM on January 15, 2010


christonabike: "I'd love to make the switch to jQuery, but I don't want to spend the time rewriting thousands of lines of Javascript."

Considering "thousands of lines" generally becomes "a hundred lines" when you switch from the "standard" DOM API to jQuery, it's actually a really pleasant experience.
posted by Plutor at 9:10 AM on January 15, 2010


and you've just reminded me of AJAX .NET, which is a horror

One of those things where I spent a week thinking I was incredibly stupid for not getting it, then bothered to ask a coworker how they were doing with it and immediately realized it wasn't me.
posted by yerfatma at 11:00 AM on January 15, 2010 [1 favorite]


The viewstates! The viewstates!

Man, I am a full year from having looked at anything with a viewstate. I am so happy about that. If you do not know what a viewstate is then count yourself lucky.
posted by Artw at 12:58 PM on January 15, 2010


I am so happy about that. If you do not know what a viewstate is then count yourself lucky.

Especially when deploying to a large number of web servers that are not using sticky sessions on the load balancers. *shudder*
posted by flaterik at 1:53 PM on January 15, 2010


« Older Unclean slate   |   Meet America's First Legal Male Prostitute Newer »


This thread has been archived and is closed to new comments