Using jQuery in javascript class

function count(x,y) {
  this.x;
  this.y;
  this.plus = function() {
    return this.x + this.y;
  }
  this.checkResult = function() {
    $("#test").click(function() {
      this.plus(); //help here
    });
  }
}
<p id='test'></p>

“this” return the element that’s clicked, so how to run method inside jQuery?


Source: jquery

Leave a Reply