I\'ve got a problem concerning the javascript \"this\" keyword when used within a javascript functional object. I want to be able to create an object for handling a Modal po
Try to add a variable that is equal to global this e.g
function CreateItemModal(config) {
// initialize some variables including $wrapper
};
CreateItemModal.prototype.show = function() {
var $this = this;
this.$wrapper.dialog({
buttons: {
// this crashes because this is not the current object here
Cancel: $this.close
}
});
As for me, it works in most cases