This Cyber Monday Envato Tuts+ courses will be reduced to just $3. Don't miss out.
For those of us who may be unfamiliar with you and your work, tell us more about yourself and what you do for a living
I'm a (mostly front-end) web developer at a small agency, Fusionary Media, in Grand Rapids, Michigan. At 41, I'm probably older than most web developers, but most of the time I still feel like a kid. Outside of work, I'm very involved with jQuery. I'm on the jQuery project team, and I write about it, train others how to use it, and speak about it at conferences.
How and why did you first get involved with web development?
My very first involvement with web development was in 1995, when I built a simple site for a coffeehouse that I owned. After that I dabbled with web stuff here and there, because I really got a kick out of it, but I didn't start doing it as a job until about four years ago.
What are some of your hobbies when you are not working?
I like to read, run, and hang out with my family. Up until a year ago, I had studied karate for about seven years, and I'm considering starting that up again. I also enjoy photography, discovering new music, and geeking out with my friends.
Tell us more about EnglishRules.com and how the website started.
It's a personal blog of mine that I've been neglecting lately. I can't remember exactly when I started it — 2000? 2001? — but the idea was to provide some information and links for my students. I was teaching High School English at the time. Since then it has become a mishmash of my fleeting interests. In 2003 I loaded up Movable Type and started blogging on it. At some point I thought it would be fun to post a a new word each day from whatever I happened to be reading at the time, so I did that for a while. Then I had the crazy notion that I could answer the world's questions about grammar, punctuation, style, spelling, and so on, but that didn't last long. I posted a bunch of my photography on the site for a while, but that has sort of stalled as well. Probably the biggest motivation to keep it running was to give friends and family a snapshot of what I'm doing, but lately Facebook and Twitter have been filling that need.
I started using jQuery sometime around May or June of 2006. I still have a copy of "Rev 27" of the jQuery core file from May 2, 2006, before it even had a version number. It's a shame the file is compressed and obfuscated. It would be really fun to dig through it and see how much has changed.
Which came first, LearningjQuery.com or the Learning jQuery book?
The site came first. After playing around with jQuery for a couple months, I thought it would be a good idea to start documenting what I had learned. I asked John Resig if he'd mind my using the jQuery name and blogging about my experiences, and he was enthusiastic about the idea.
A few months after I started the blog, someone from Packt Publishing contacted me and asked if I'd like to write a book about jQuery — an offer that both flattered and terrified me. I agreed to do it, but only if my friend (Jonathan Chaffer) could write it with me. He is a much better programmer than I am, and I was still just a novice at the time.
Why jQuery? Why not MooTools or Prototype?
The question I see asked most often on the jQuery discussion list (Google Group) is along the lines of "Why do my events stop working after I've inserted elements into my document?" We have a detailed FAQ topic that answers this question. I've written a couple articles on learningjquery.com about it. We have the Live Query plugin and, as of jQuery 1.3, the .live() method that solve the problem. Yet despite all of that, the question still comes up a few times a week.
Besides the jQuery docs, where can users find other jQuery resources to help solve any issues they may be having with the library?
Aside from learningjquery.com and the Learning jQuery 1.3 book, there are quite a few great resources. Remy Sharp has some terrific screencasts on his jQuery for Designers, site and I've seen some great articles from Marc Grabanski and James Padolsey on their respective blogs. The jQuery Google Group is very popular, with over 16,000 members and the #jquery IRC channel on freenode.net is quite active and helpful.
Can you name one feature you wish jQuery came packaged with that it currently does not
I wish the .live() method would work with all event types. Currently it only works with a subset, so you can't use it with change, focus, blur, submit, mouseenter, or mouseleave. I also think it would be cool to allow an anonymous function to be used as an argument for .css(), .val(), and .html() the same way it is for .attr().
I'm afraid these are going to sound like platitudes, but here goes: Don't be afraid to learn as you go. You don't have to have everything figured out ahead of time. Be willing to make mistakes. Keep learning new things about the language, and try to make connections between what you already know and what you're currently learning.
Can you name some 'bad practices' you see being used often with jQuery?
Sure. One bad practice is using jQuery for something that you could do more easily and efficiently with CSS. For example, web developers for years have been changing the background position of an image sprite when the user's mouse hovers over a link. There is absolutely no reason to use jQuery for this, unless the developer wants the hover-state change to be animated.
Another bad practice is unnecessarily repeating selectors. Instead of creating another jQuery object each time you want to do something to a particular set of elements, chain the methods or store a reference to the jQuery object in a variable and use that.
What are some ways one can improve their knowledge of jQuery and become more efficient when working with the framework?
Read tutorials from reputable sites. Ask questions on the discussion list and read answers to other people's questions. In particular, read everything that Michael Geary and Dave Methvin post on the list. Try to emulate the code of great plugin authors such as Mike Alsup, Ariel Flesler, Jörn Zaefferer, and Brandon Aaron.
jQuery plugin development has really taken off over the past two years, do you have any favorite plugins you frequently use or do you prefer to write your own?
I often write my own, but I do use a few quite frequently. Every client seems to want some kind of image rotator on their homepage, so I use Mike Alsup's Cycle plugin for that. I also use his Form and Media plugins quite a bit. I often rely on Joel Birch's Superfish plugin and Brian Cherne's hoverIntent plugin when a client wants drop-down menus. Lately I've been using jQuery UI more and more for general widget theming, advanced effects, sliders, and draggable/droppable elements.
Are there any specific features (or lack thereof) that you do not like about jQuery?
I'm not crazy about some of the method names in the API. In very early versions of jQuery, there were two method names for traversing all the way up the DOM tree: .parents() and .ancestors(). When the API was trimmed, .ancestors() was dropped. I would have preferred dropping .parents() instead because I think "ancestors" better describes what is being selected. And while in general I like how jQuery overloads methods, I think the .load() and .toggle() methods take the idea a little too far.
You've written numerous books on jQuery, what is the most difficult part of getting these books published?
The toughest part is probably just staying on schedule. But it's absolutely essential to set a reasonable schedule ahead of time and stick to it the whole way through.
What do you think the future holds for the jQuery framework?
Most of the changes to the jQuery core are going to be in the areas of performance, stability, and bug fixes. I don't see a lot of new features being added to core. For new features, keep an eye on jQuery UI. There is a lot of great new stuff being developed there.
Do you have any more books that you are planning to publish anytime soon?
I'm one of several technical reviewers for a jQuery cookbook that is in the works. But I'm not currently authoring any books and don't have plans to do so any time soon.
Do you have any shameless plugs you would like our readers to know about?
Nothing that hasn't already been mentioned, but thanks for the offer!
Thank you so much for taking the time to chat with me Karl, and thank you for all the great jQuery resources, tricks, and tutorials you have given to the community over the years.
My pleasure! I'm flattered by your interest in what I have to say.
- Follow us on Twitter, or subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.