In jQuery UI, widgets are created like this:
$("#selector").accordion({ //options });
How would I go about creating my own widget that would be created like this? Mainly, I need to know how to define a function that can be called on a DOM element (I'm a javascript newbie and the jQuery UI code isn't so readable).