Jquery.UI Widget example

Minimal code sample:

;(function ($, undefined) {
  $.widget('name.space', {
    iAmPrivate: undefined,
    options: {
      /* default options */
    },
    _iAmPrivate: function () {},
    iAmPublic: function () {},
    _create: function () {},
    _setOption: function (key, value) {
      this._super('_setOption', key, value)
    },
    destroy: function () {
      this._super('destroy')
    }
  })
})(jQuery)

Links

Widget Factory

Tips for developing jquery.ui widgets

Coding your first jquery ui plugin

Example

mac.message.html