I have a simple class.
The problem im having is that my onClick function is never called when clicking on the div element.
class card {
constructor(parent, element) {
this.parent = parent;
this.element = element;
this.element.on({
'click': $.proxy(this.onClick, this)
});
}
onClick() {
console.log("onclick");
}
}
class cards {
constructor() {
this.element = $(".cards");
this.cards = [];
this.element.children(".card").each((obj) => {
this.cards.push(new card(this, $(obj)));
});
}
}
var my_a = new cards();