Thoughts/resources for making a jQuery plugin

I thought I would share a couple resources for people looking to write a jQuery plugin but aren’t super confident in their JavaScript skills yet.

Writing a jQuery plugin was fairly simple. At first it seemed very difficult, but that was because I was looking at JavaScript wrong. I didn’t really know the language well and what it was capable of. This is mostly because I was used to just hacking around with vanilla JS and jQuery without knowing the “right” way to do things. I still might not be doing things the 100% “right” way but I’ve come a long way from what my code originally looked like.

First, get familiar with JavaScript. This might be terrible to say but honestly most of what I know about JavaScript is stuff I carried over from my Java knowledge in college. I knew enough to hack around and make things work. JavaScript and Java are so different and each language has its own set of strengths and places where it’d be useful. I’d highly recommend JavaScript: The Definitive Guide (6th edition) for learning the ins and outs of JS. You’ll probably be surprised at how much you didn’t know about JS.

If you can’t buy that book, check out Eloquent JavaScript. It’s a very good resource on JS. Do the examples, they’re very helpful.

Second, demystify jQuery and gain a deeper understanding of what’s going on with it by watching Paul Irish’s “10 Things I Learned From the jQuery Source”. Watching this really made a lot of things “click” in my head and gave me a better understanding of what is happening when you use jQuery.

Third, I’d recommend reading some stuff by Addy Osmani on design patterns. He gives some best practices on how to make a jQuery plugin. It seemed a little over my head at first, but I promise it’ll make sense if you stay with it and let all the new knowledge you took in gel together.

With these tools in your toolbox, you can’t fail. Go forth and make cool things for the web.

Leave a comment

What do you think?

%d bloggers like this: