In my 30 Days to Learn jQuery course, I’ve taken a slightly different approach to teaching. When first learning a framework or library, it’s common to think of the underlying code as a magic box of sorts. Don’t concern yourself with how it works; just be thankful that it does! But, if you think about it, this benefits no one.
The source is your friend, not black smoke!
That’s why, beginning at lesson one of my course, I frequently refer to the jQuery source to explain certain concepts.
- Why can you also pass a
function
tojQuery
to mimic the functionality of$(document.ready(fn)
? Let’s refer to the source code and figure out what’s going on behind the scenes. - What is the difference between
live
anddelegate
? Well, check the source. The answer is, these days, very little; they both point to theon
method.
By forcing the jQuery source on new users, not only do you demystify the “magic box” illusion, but you also teach them to think of it as their documentation – the first place you refer when you have a question.
Feedback
So far, people really seem to be enjoying that teaching angle. I worried at first that it would intimidate new users with very little jQuery experience, but the opposite seems to be the case! As long as you break down the complicated code into chunks that the viewer can understand, it fills them with a bit of empowerment — “Hell yes, I read the jQuery source!”