I am writing classes of JavaScript in this way.
var Dialog = function () {
this.dlg = $('<div>', { id: 'dlg' });
};
Dialog.prototype.show = function () {
this.dlg.animate({ opacity: 1.0 }, "fast");
};
Dialog.prototype.close = function () {
this.dlg.animate({ opacity: 0.0 }, "fast", function () { $(this).remove(); });
};
However, depending on the calling source of a function, 'this' of 'this.dlg' points not Classes itself but the element of jQuery. They were buried in advices about css's classes and I was not able to find a solution by Google. How should I define those Classes?