Uncaught TypeError: jQuery is not a function | Community
Skip to main content
Roshanchauhan
Level 3
Jul 26, 2018 8:55 AM UTC
Solved

Uncaught TypeError: jQuery is not a function

Hi There,

Below script is throwing the "Uncaught TypeError: jQuery is not a function" due to that custom tracking get stopped. Could anyone help me to solve this issue.

function bindKudoEvent(){

jQuery('.lia-button-image-kudos-kudoed a.kudos-link').on('click',function(e){

var isAcceptedSol = jQuery(this).parents('.lia-message-view-display').hasClass('lia-accepted-solution');

trackClickTkb(0,"kudo count",isAcceptedSol)

setTimeout(function(){ bindKudoEvent() }, 3500);

});

jQuery('.lia-button-image-kudos-not-kudoed a.kudos-link').on('click',function(e){

var isAcceptedSol = jQuery(this).parents('.lia-message-view-display').hasClass('lia-accepted-solution');

trackClickTkb(1,"kudo count", isAcceptedSol)

setTimeout(function(){ bindKudoEvent() }, 3500);

});

}

bindKudoEvent();

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Stewart_Schilling
Stewart_SchillingAccepted solution
New Participant
Aug 7, 2018 1:07 PM UTC

Typically, when I see an error like this, it is an indication that the function has been inadvertently overwritten by something that is not a function.   Below is an example of this.

==========================================

Beyond this, the code that you shared has issues.  It is recursing and installing multiple click listeners on your button.

You end up getting a new event listener installed every 3.5 seconds.  That means that if you sat on the page for 36 seconds, and then clicked the button,

      trackClickTkb(0,"kudo count",isAcceptedSol)

would be fired 10 times.

DTM is very good at listening for click events. You should just use DTM event rules for this sort of thing.

3 replies

Stewart_Schilling
Stewart_SchillingAccepted solution
New Participant
Aug 7, 2018 1:07 PM UTC

Typically, when I see an error like this, it is an indication that the function has been inadvertently overwritten by something that is not a function.   Below is an example of this.

==========================================

Beyond this, the code that you shared has issues.  It is recursing and installing multiple click listeners on your button.

You end up getting a new event listener installed every 3.5 seconds.  That means that if you sat on the page for 36 seconds, and then clicked the button,

      trackClickTkb(0,"kudo count",isAcceptedSol)

would be fired 10 times.

DTM is very good at listening for click events. You should just use DTM event rules for this sort of thing.

Translate
Roshanchauhan
Level 3
Aug 7, 2018 7:20 AM UTC

jQuery script is loaded correctly in HTML page still facing the issue, this happened mostly on Page load.

Translate
AnalyticsAlice
Level 2
Aug 6, 2018 5:03 AM UTC

Hi there. What happens if you run JQuery on its own in the console? Have you checked that the jQuery script is loaded correctly in your page HTML?

Translate