title: jQuery Uncaught TypeError in $(selector).on()
body: <p>I am getting the following error:</p>
  <blockquote>
  <p>Uncaught TypeError: ((jQuery.event.special[handleObj.origType] || (intermediate value)).handle || handleObj.handler).apply is not a function</p>
  </blockquote>
  <p>This is my code and it's somewhere in between the <code>beforeSend</code> and the <code>success</code> calls that the error is happening:</p>
  <pre><code>$('#main-container').on('click', '#sign-in-btn', function (event) {
      var username = $('#username-textbox').val();
      var password = $('#password-textbox').val();
  
      $.ajax({
          url: '/login',
          method: 'POST',
  
          beforeSend: function (xhr) {
              xhr.setRequestHeader('Authorization', 'Basic ' + btoa(username + &quot;:&quot; + password));
          },
  
          success: function (data) {
          }
      });
  
      event.preventDefault();
  });
  </code></pre>
  <p>I also tried to put inside  a <code>$(document).ready(function () { ... }</code> call and I get the exact same error.</p>