I use the jQuery extend function to extend a class prototype.
For example:
MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidge
I quite like John Resig's Simple JavaScript Inheritance.
var MyWidget = Class.extend({
init: function(widget_name){
this.widget_name = widget_name;
},
doSomething: function() {
alert('my name is ' + this.widget_name);
}
});
NB: The "Class" object demonstrated above isn't included in jQuery itself - it's a 25 line snippet from Mr. jQuery himself, provided in the article above.