In MSDN there have a nice article on JQuery Widget http://msdn.microsoft.com/en-us/library/hh404085.aspx. Silk Project is real good example of Jquery Widget.
I found some nice wizard control using Jquery those are dependent on HTML controls. Some good articles on Jquery Widget :
both are almost same and I am not here reinventing wheel. I am using the second article code to create wizard plugin so that I can make it more reusable but I can not say that is perfect for any type of requirement.
If you read the second article ( mentioned above) Code are pretty simple to understand. I am here just trying here to covert it into Jquery widget.
Jquery widget has constructor like _create method which is invoked first time. Here underscore is used to define private scope. So other object can not call _create method.
So in the _create method I have defined how control can be bind to methods and how control would be displayed initially.
To make it independent of particular Form, I have some properties inside Widget options so that we can set ui element or action there. Wizard widget can be called in form as like other widget.
Here back-step, next-step are HTML button ids. and ConfirmAction and FinalAction are methods which is using as callback method.
To set those properties jquery widget provides us to create options object with these properties.
In this code we have exposed some properties so that user can set those properties as defined above and in _create method provided control ids are bind with widget method to make it reusable.
We exposed two method for logic to go next step or in previous step. This code need more improvement to make it more reusable. In the moveNext() method I have called callback method so that we can perform some actions which are dependent on particular UI control
Here is complete code of Wizard plugin. https://dl.dropbox.com/u/20275838/Wizard.js