Karl's Archive


This post has been a long time in coming, and I’m sure it comes as no surprise to anyone who has been to the site in the past year and a half. But it’s time to make it official: the Learning jQuery blog has come to an end.

I started this blog seven years ago when I was just getting my feet wet with programming for the web as a way to record and help solidify all that I was learning about jQuery (hence the blog’s name, duh). Soon thereafter I started inviting others to write here as well in the hopes of having the site be a good destination for solid information about my favorite JavaScript library.

We had a good run with it, but after a while the frequency of posts started to drop. At the same time, but not merely coincidentally, other demands on my time were ratcheting up: family, day job, friends IRL, and so on. And although I spent far too much time over the last year or so feeling guilty about not writing here, that feeling never translated into another blog post. I still love jQuery, still use it, and still contribute when I can, but I’ve come to the conclusion that if twenty-some months and a whole lot of guilt aren’t going to motivate me, it’s time to accept the obvious and close up shop.


Besides, other sites have sprung up in the meantime that offer better and more up-to-date material on jQuery. In particular, I’d like to direct you to the official jQuery Learning Center. It’s awesome, and it’s community driven. You can even contribute to it yourself, if you’d like.


Before I end, I’d like to express my gratitude to everyone who has contributed to this site. Thanks to all the authors who were willing to write about their tips and techniques and deal with my nitpicky editing. Thanks to all the commenters who asked great questions or showed me a better way to do something than what I had detailed in a post. Thanks to John Resig (@jeresig) who created jQuery and encouraged me to start this blog and remained a friend and mentor throughout the years. Thanks to Dave Methvin (@davemethvin‎), who picked up the torch and is doing a fantastic job of keeping jQuery lean, clean, fast, and useful. And thanks to the people in the jQuery community, both past and present, who have taught me so much, including, in no particular order (and if I left anyone out, I’m sorry. Send me an email, and I’ll add you to the list.):

Clarification: The site will remain online for the foreseeable future. As time permits, I’ll update posts with updated information or links to other resources.

Using jQuery’s .pushStack() for reusable DOM traversing methods

The .pushStack() method has been in jQuery since before version 1.0, but it hasn’t received a whole lot of attention outside of core developers and plugin authors. While its usefulness may not be immediately apparent, it can come in really handy in some situations, so I’d like to take a quick look at what it does, how it works, and how we can use it.

pushStack Basics

At its most basic level, the .pushStack() method accepts an array of DOM elements and “pushes” it onto a “stack” so that later calls to methods like .end() and .andSelf() behave correctly. (Side note: As of jQuery 1.4.2, you can pass in a jQuery object instead of an array, but that isn’t documented and jQuery itself always uses an array, so that’s what we’ll stick to here.)

Internally, jQuery uses .pushStack() to keep track of the previous jQuery collections as you chain traversing methods such as .parents() and .filter(). This lets us traverse through the DOM, do some stuff, “back up” to previous collections within the same chain using .end(), and then do something else. Here is a somewhat contrived example:

Read the rest of this entry »

Introducing jQuery API Search

Half-baked tutorials and plugins have been stacking up for months in my virtual kitchen, waiting for me to fire up the oven, finish the cooking, and spread them out on the table. For some reason, though, I’ve become less and less sure about whether I’ve put all the right ingredients into the mix. It’s irritating, to be sure, but I’m tired of fretting about it. I’m going to consider this the first of what I hope to be many “taste tests” — experiments in various degrees of completion thrown against the wall to see what, if anything, sticks.

As some of you may know, the online jQuery documentation went through a major overhaul in January of this year, coinciding with the release of jQuery 1.4. Packt Publishing “open sourced” the jQuery 1.4 Reference Guide that Jonathan Chaffer and I had been writing, allowing us to put its entire contents (and more) on api.jquery.com. Some of you may also know that the raw XML content of the site is available as a single file, which has allowed other sites such as jqapi.com and idocs.brandonaaron.net to provide alternative views of that content. But what most of you probably do not know is that the jQuery API has been available for quite some time as a searchable API that returns the results in JSON format.

Read the rest of this entry »

Flip your Tip: Keeping the Event-delegation Tooltip in View

Before we begin, please accept my apologies for not posting this tutorial sooner. I know at least two or three people were beginning to wonder if I’d ever finish what I started with this tooltip series. Please also forgive me if the phrase “flip your tip” has a double meaning in some ultra-hip corner of the universe. If it does, I can assure you that I am unaware of it—ignorant and unhip, to be sure, but more important, innocent. Now, on with the show.

Quick Review

In my last three tutorials, I discussed how to put together a very simple tooltip, and I introduced a different feature or concept in each one. In an effort to continue in the spirit of simplicity, I will refrain from repeating the explanations of previous posts and instead simply direct your attention to them before we begin:

Read the rest of this entry »

Spring 2010 jQuery Conference: San Francisco Bay Area

Since the fall of 2007, jQuery developers around the world have been making an annual pilgrimage to Boston, Massachusetts, to meet jQuery team members, JavaScript luminaries, and other jQuery developers at the official jQuery Conference. This spring, in response to growing demand, the jQuery Project is offering its first-ever official jQuery conference on the U.S west coast. The conference will take place April 24–25 in Mountain View, California, and will include top-notch presentations from the jQuery team, as well as other web development and performance experts. Additionally, the conference will be preceded by a one-day intensive jQuery training course in downtown San Francisco, led by appendTo a leading jQuery training and consulting company.

Read the rest of this entry »

Using setTimeout to Delay Showing Event-Delegation Tooltips

In my last two tutorials, I explained how to use event delegation for showing and hiding tooltips. In a comment on the first one, Jan Aagaard asked how we might go about enhancing the script by adding a small delay before showing a tooltip. The answer lies with two JavaScript functions, setTimeout() and clearTimeout().

Read the rest of this entry »