Use the composition pattern when extending third-party library objects:
js
// new class-like function
var Container = function(id) {
// jQuery object
this._element = $('#' + id);
};
// add your own method
Container.prototype.changeBackground = function(bg) {
this._element.css(background: bg);
};
// use the new class
var container = new Container;
// change background to red
container.changeBackground('#f00');