title: Define a UI element like the ones in jQuery UI
body: <p>In jQuery UI, widgets are created like this:</p>
  
  <pre><code>$("#selector").accordion({ //options });
  </code></pre>
  
  <p>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).</p>