A widget is an intricate piece of functionality, but fortunately we are not left completely to our own devices in creating one. The jQuery UI core contains a
factory method called
$.widget(), which does a great deal of the work for us. Using this factory will help ensure that our code meets the API standards enjoyed by the users of all jQuery UI widgets.