If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

John Resig: Building jQuery

Charles Severance interviews jQuery inventor John Resig about how and why he built jQuery. Visit Khan Academy to learn how to use jQuery in our interactive tutorials: https://www.khanacademy.org/computing/computer-programming/html-js-jquery.

Want to join the conversation?

No posts yet.

Video transcript

(upbeat music) - See, I started working on JQuery in 2005 before then it wasn't, JQuery wasn't even a thing. It was just a collection of tools that I had written. It was mostly because I had been creating a number of websites and resources around that time and I kept wanting to have the certain utilities to make my development easier, and part of that was one just working around sort of like the browser incompatibilities that existed at the time. There was, you know, Internet Explorer, and Firefox. It was just so hard to try and develop against all these different browsers simultaneously. So that was one issue, but the other issue was just that I felt that the preexisting development tools, especially the JavaScript development tools, could be better. The most popular library at the time was the prototype JavaScript library and this was one that was bundled with the Ruby on Rails framework, so it was popular and it was taking off with rails, and that library actually I found it to be extremely informative. That was the first time I had seen a JavaScript library written in a nice, clean, obagetoriantive manner, where you have nice, all these nice functional paradigms built into it, and I didn't really realize that JavaScript could be so beautiful and elegant. And once I saw that, it really inspired me to want to build something even better, and I realized that prototype primarily focused on the JavaScript language whereas there weren't many tools that focused on the JavaScript language inside the browser, specifically manipulated HTML in the DOM and so there was this gap here and there was this big usability chasm and so that's when I started to build different tools and different libraries and eventually all these kind of glommed together into a single library, which I ended up calling JQuery. I was originally gonna call it JSelect, but that domain was taken or something and I ended up going with, going with JQuery and ended up releasing it January of 2006. I should say, at the time I was in college. I was doing all of this while I was in college and all these different projects and stuff I was working on were just various side projects and things that I had and JQuery kind of spun out of these side projects. And I should say none of those side projects exist anymore. JQuery is the only one that still exists. So the Selector Pattern came from, at least where I saw it from, was this library written by this developer in the UK, Simon Willison, and he created this method where it was like, "get elements by Selector" if I remember correctly, and it allowed you to just run a simple CSS Selector and find some elements, but it was very, very primitive. You could only do just the most basic of queries and it didn't have the full, nice, CSS two inches, three, and everything. And so one of the things I wanted was one, I wanted a better version of that library, a more comprehensive version, and additionally, I wanted to make the process of attaching events into the page. Because when you're building an interactive JavaScript application, you need to listen for when the user's gonna be doing certain things and so doing that process of finding an element and attach an event to it, I wanted to optimize completely for that. And so that's really what JQuery was initially all about and it wasn't until later that I started in adding and other things like being able to have like animations and it wasn't even until after I released it that I added Ajax and stuff. That's because other people wanted it. I wasn't even using that personally. So it really was, I was definitely inspired by all these other developers and their libraries and they just weren't quite perfect. I wanted to be just that little bit better to all fit together. - So how'd it go from you sort of making something and giving it, to it sort of taking on a life of it's own cause it didn't take long for it to take on a life of its own. - It felt like it took a long time to take on a life of its own. Mostly because, so like you know, release it January 2006, and one of the very first design decisions I made, I guess there were a couple that I made right from the start that helped a lot. One was that I provided an explicit plugin architecture, so that people could write plugins and add them into the JQuery library and then now they could get the full advantage of this framework. The other decision I made was that on the very first day it was released, I had documentation written. Like I sat down and went through every method and documented it and how it worked and provided little examples and one thing I think is interesting is that from January 2006 when I released the library, to January 2007, JQuery was the only library, the only JavaScript library with documentation. All the others were just like, "Read the source code" or "Go through revision control" or whatever it was and that always really surprised me. Well, I think it's just a side effect of developers. Like you want to write your code, you don't want to do the boring stuff and writing docs and whatever, and so at least as far as the growth of the library, there were a lot of decisions that I made over the course of its history that weren't code related. And one of the things I always try to emphasize is that when you're trying to manage a good project, especially a good open source project, code is only a very small portion of the total equation. You have to spend a lot of time and a lot of effort in making something that people are going to want to learn, that it's is easy for them to learn, and that once they do learn it, they don't get frustrated and leave later on. And you have this whole flow that you have to make sure at every step of the way that people are happy and as satisfied and that they're learning, so that usually involves doing things like you have to make sure you have a clear website, that it's easy to download whatever you're trying to give, that the documentation is very clear, that you have like a very nice like Getting Started guide, but then additionally that you have a community built up around this. Now the very first person I brought on to the JQuery team, at this point it was just me, then the next person I brought in was actually someone to help manage the community and not another developer per se and although he was a developer. And because the reason why I wanted this was I wanted to make sure that if anyone was having a problem anywhere, that their needs were going to be taken into account and that we would be able to help and fix whatever issue that they were hitting. So we were just extremely proactive in fixing browser issues, in finding just issues in the library in general, and Summer of 2006 till the end of 2006, I was actually in Y Combinator, the startup accelerator run by Paul Graham and co. and at that time they were in Boston and I moved to Boston with some friends. We tried to do a startup, which ended up failing. Well we did not get enough funding and it just didn't take off. Once the startup went away, I ended up joining Mozilla and there I worked as primarily for many years, a JavaScript evangelist. So my job was to promote JavaScript and get people, you know, to understand what's coming in the specifications, tools, and all sorts of stuff like that. But again, I wasn't actually working on JQuery as part of my job. Like it was still very much like, I would do that and then in my spare time I would just be doing mailing lists and fixing bugs and all those sort of things you have to do. It wasn't until about my last year at Mozilla, so like about 2010 to 2011, that they actually said, "Okay, you can work on JQuery full time" and that's when I started working on it. And it was great because what I ended up doing during that time was I put a lot of effort into making sure there was infrastructure in place so that if I wasn't working on it, if I wasn't there on a day to day basis, it could continue to exist and part of that was setting up a non-profit and making sure that there were enough people working in every aspect of it such that when I eventually came and joined Khan Academy, I actually stepped down from the JQuery project and everything's been running very well since and I can just use JQuery now as a happy consumer.