jquery class inheritance jquery class inheritance jquery jquery

jquery class inheritance


For OO, it's best to look outside jQuery. jQuery is based on collections returned by selectors.

If you want classes, some choices are Base2, Joose, and JS.Class.


John Resig created a snippet for simple inheritance here.http://ejohn.org/blog/simple-javascript-inheritance/

he stores the super class to a _super variable so you can call it like such

this._super();

you can reference his code snippet to get a better idea of what he another helpful post is:http://alexsexton.com/?p=51


How to invoke parent's methods:

var B=function(){    A.call(this);};$.extend(B.prototype,A.prototype,{        init:function(){                A.prototype.init.call(this);                alert('B init');        }});