I wanted to call a method within a method of the same class.
function Dialog() {
this.close = function() {
//code
};
this.dialog = document.createElement("div");
this.dialog.onclick = function() {
this.close();
}
document.body.appendChild(this.dialog);
}
var test = new Dialog();
I searched for anwers but nothing helped: I still get TypeError: this.close is not a function
in the console of my browser when I click the the div.