Uncaught TypeError: jQuery is not a function

Avatar

Avatar
Validate 10
Level 3
roshanc44331495
Level 3

Likes

25 likes

Total Posts

38 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 10
Level 3
roshanc44331495
Level 3

Likes

25 likes

Total Posts

38 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile
roshanc44331495
Level 3

26-07-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
StewSchilling
MVP

Likes

342 likes

Total Posts

279 posts

Correct reply

85 solutions
Top badges earned
Coach
Give Back 25
Springboard
Bedrock
Validate 1
View profile

Avatar
Coach
MVP
StewSchilling
MVP

Likes

342 likes

Total Posts

279 posts

Correct reply

85 solutions
Top badges earned
Coach
Give Back 25
Springboard
Bedrock
Validate 1
View profile
StewSchilling
MVP

07-08-2018

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.

Screen Shot 2018-08-07 at 7.56.05 AM.png

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

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.

Answers (2)

Answers (2)

Avatar

Avatar
Validate 10
Level 3
roshanc44331495
Level 3

Likes

25 likes

Total Posts

38 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 10
Level 3
roshanc44331495
Level 3

Likes

25 likes

Total Posts

38 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile
roshanc44331495
Level 3

07-08-2018

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

Avatar

Avatar
Give Back
Level 2
AnalyticsAlice
Level 2

Likes

10 likes

Total Posts

10 posts

Correct reply

7 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Give Back
Level 2
AnalyticsAlice
Level 2

Likes

10 likes

Total Posts

10 posts

Correct reply

7 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile
AnalyticsAlice
Level 2

05-08-2018

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?