Marvel Moe Marvel Moe - 2 months ago 19
jQuery Question

jQuery Uncaught TypeError:

So im getting a Uncaught TypeError: Cannot read property 'call' of undefined on this site: http://baybridgeinn.com

This is a WordPress site and I have included a screenshot of what chrome debugger points to. Someone said it might be related to the Api keys warning but I dont think that is connected to it. Would appreciate any help. error screenshot

Answer

You have the following in your Javascript:

$('a[href^="tel:"]').each().addClass("ga-phone");

.each() requires a function argument, so it should be:

$('a[href^="tel:"]').each(function() {
    $(this).addClass("ga-phone");
});

But you don't need to use .each(), because jQuery setters will automatically loop through all the elements in the collection. So it should just be:

$('a[href^="tel:"]').addClass("ga-phone");
Comments