0

NOTE* I'm aware there is another question concerning this issue, however that question is specific for the other users issue. I'm looking for a way to drill into this error and find the issue.

Im getting this Type Error:

Uncaught TypeError: ((x.event.special[i.origType] || (intermediate value)).handle || i.handler).apply is not a function

On keypress in a particular text area. Here is the code for the Jquery Keypress

$(document).on('keypress', '#NewComment', function() {
    $(this).removeClass('ErrorBorder');
    $('.btn-Submit-Comment').prop("disabled", false);
});

I've checked firefox dev tools and this is the only Jquery function bound to the #NewComment text area.

If i comment out the keypress im still getting this Type Error? Any suggestions on how to dig further into this error to find whats causing this. My current code base is 1.5+ million lines of code.

enter image description here

This error is thrown when any key is pressed within the textarea

Charles L.
  • 1,844
  • 2
  • 34
  • 56
  • Possible duplicate of ["e.handler.apply" is not a function in jquery table sorter](https://stackoverflow.com/questions/24283006/e-handler-apply-is-not-a-function-in-jquery-table-sorter) – Peter B Jul 10 '17 at 15:12
  • @PeterB yeah i read through that question. The problem here is the answers are very specific and did not help my issue. – Charles L. Jul 10 '17 at 15:13
  • It suggests that you have a missing `function() {}` that could be anywhere, not necessarily related to the #NewComment element (because if you comment this one out the error still occurs) – Peter B Jul 10 '17 at 15:14
  • @PeterB Yeah im looking for a more specific way to dig into this error. Looking through 1.5+ million lines of code isnt going to work. And then why is this ONLY happening on this textarea :/ – Charles L. Jul 10 '17 at 15:15
  • Perhaps this might help: https://stackoverflow.com/a/2518441/1220550 although maybe it will only find the *valid* handlers, and not this invalid handler... – Peter B Jul 10 '17 at 15:22
  • @PeterB yeah that doesnt help find all the invalid handlers... :/ – Charles L. Jul 10 '17 at 15:32
  • What happens with $('#NewComment').keypress(function() { }); with your stuff in there - does that button exist? – Richard Housham Jul 10 '17 at 15:52

1 Answers1

1

Corrected this issue, It was being caused by a double .on within my code. thousands of line deep. Really frustration Jquery doesn't have better error handling for this specific error. I had to dig through all my JS code and start commenting out functions until I found it

Charles L.
  • 1,844
  • 2
  • 34
  • 56