Writing Jquery Plugins


Jquery has made developing javascript fun and enjoyable. It is a fantastic library that essentially allows the creation of library extensions on top of it via plugins. Jquery plugins are surprisingly easy to write and elegant to read and use. Here are a few tips on where to find good plugin candidates, design principles for plugins, and an outline of the basic structure that I have found most useful when writing plugins.

Writing jQuery Plugins slidedeck

Plugins aren't magical or anything. In fact, any code that you can produce that's delivered as a plugin can be written without a plugin. Jquery itself is just a bunch of javascript code written in a way that is packaged nicely, ready for distribution, and has a cleaned up API. That's one of the things that makes it a joy to use. Compare that with seeing a .js file full of line after line of function() { ... } and either choosing to copy paste bits and pieces or having to sift through it to determine which methods you should or want to call. Plugins provide an elegant way to create cohesive code and then distribute the idea so that others will be able to pick it up and use it more easily.