Uncaught TypeError: undefined is not a function (anonymous function) in WordPress

I am getting the following error, which appears to be Javascript not interpreting the $ symbol.

Uncaught TypeError: undefined is not a function main.js:1
(anonymous function) main.js:1

Read More

Appended below is the main.js code. This was working fine sometime back. I am trying to find out pointers to where to look for the issues, i.e. theme, jquery imports, etc. Any suggestions are welcome.

$(function(){ 
var cardHeight = 0;

function _setCardHeight(){

    $(".subpage-box").each( function(){ var current_height = 
    $(this).height();

        cardHeight = ( current_height > cardHeight) ? current_height : 
        cardHeight;

    }); $(".subpage-box").each( function(){ if( $(this).height() < 
    cardHeight ){ $(this).height( cardHeight );   } });


}

function _setNavStyle(){
    $("menu-main-menu > li > a").each( function(){
        var text = $(this).html();

        if( $(this).contains("for") ){

        }
    });
}

_setNavStyle();
_setCardHeight();

});

Related posts

Leave a Reply

1 comment