I recently have been returning a tutorial on writing jQuery plugins.

It encapsulates a lot of what I find so compelling and inspiring about Javascript & jQuery. Basically the pattern suggested is all about ways to make the resulting plugin (special functionality one wants to make available as a jQuery extension) remain adaptable by those who make use of it in their own pages. Options can be passed in when a particular element is first invoked, or changes can be made to the “default settings” of the plugin which then affects all subsequent use of the plugin (which makes the resulting use of the plugin more concise as options need not be repeated). Finally, it’s even possible using the “metadata” jquery plugin, to give options using special (otherwise meaningless) CSS style attributes. This means that the bulk of the customization remains within HTML + CSS, and the Javascript can be simply a one-liner. This underscores the clever way that jQuery often works by keeping “the page” (and the DOM) the primary “object” or means of accessing and addressing the page as opposed to splitting off into a parallel universe of Javascript code. Code purists might object to the resulting inefficiencies (it is more efficient to handle direct references to Javascript objects instead of repeatedly addressing DOM elements on the page), but the result is a unified model of a page that allows a kind of equal access to potentially different kinds of users and toolsets.