title: Issue with javascript classes and mouse clicks
body: <p>So I'm trying to classify my javascript code.</p>
  
  <p>I have a class called node, which simply contains an integer, a label element to display that integer, and a button element to increment the integer.</p>
  
  <p>When I call the <code>incrementInteger</code> function via code, everything works as expected. But when I try to use a mouse click event listener to call the <code>incrementInteger</code> function, things do not work. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>$(document).ready(function() {
      var firstNode = new Node();
      firstNode.incrementInteger();
      var secondNode = new Node();
  });
  
  function Node() {
      this.integer = 0;
      this.incrementInteger = function() {
          this.integer++;
          this.label.innerHTML = this.integer;
      }
      this.addButton = document.createElement("button");
      this.addButton.addEventListener("mousedown", this.incrementInteger);
      this.container = document.createElement("div");
      this.label = document.createElement("div");
      this.label.innerHTML = this.integer;
  
      var bodyElement = document.getElementsByTagName("body")[0];
      this.container.appendChild(this.label);
      this.container.appendChild(this.addButton);
      bodyElement.appendChild(this.container);
  }
  </code></pre>