title: Why aren't my click() to on() conversions working as expected?
body: <p>The .click in jquery is deprecated. So I made amendments to the existing code, however, there seems to be some issue.</p>
  <pre><code>    GetPageButtons() {
      let $saveButton = $(&quot;&lt;input /&gt;&quot;, {
          type: &quot;button&quot;,
          value: &quot;Save&quot;,
          class: &quot;button large save&quot;,
        }),
        $cancelButton = $(&quot;&lt;input /&gt;&quot;, {
          type: &quot;button&quot;,
          value: &quot;Cancel&quot;,
          class: &quot;button large cancel&quot;,
        });
      $saveButton.click(() =&gt; {
        this.UpdateRecord();
      });
      $cancelButton.click(() =&gt; {
        this.modal.success = true;
        let _parent = this;
        $.each(_parent.fields, function (i, field) {
          delete this.newValue;
          this.element.val(&quot;&quot;);
        });
      });
      return [$cancelButton, $saveButton];
    }
  </code></pre>
  <p>The above code works, although my linter complains saying it deprecated.</p>
  <pre><code>  GetPageButtons() {
      let $saveButton = $(&quot;&lt;input /&gt;&quot;, {
          type: &quot;button&quot;,
          value: &quot;Save&quot;,
          class: &quot;button large save&quot;,
        }),
        $cancelButton = $(&quot;&lt;input /&gt;&quot;, {
          type: &quot;button&quot;,
          value: &quot;Cancel&quot;,
          class: &quot;button large cancel&quot;,
        });
      $saveButton.on(&quot;click&quot;, function() {
        this.UpdateRecord();
      });
      $cancelButton.on(&quot;click&quot;, function() {
        this.modal.success = true;
        let _parent = this;
        $.each(_parent.fields, function (i, field) {
          delete this.newValue;
          $( this ).element.val(&quot;&quot;);
        });
      });
      return [$cancelButton, $saveButton];
    }
  </code></pre>
  <p>The refactor to the suggested use of .on('click', fn){} however is not functioning. I get an error that says:</p>
  <p>&quot;Uncaught TypeError: this.UpdateRecord is not a function&quot;.</p>
  <p>Why? It should work the same as the .click which is shorthand for .on.
  Any suggestions???</p>