TypeError: $ is not a function when calling jQuery function

后端 未结 16 2163
慢半拍i
慢半拍i 2020-11-22 02:42

I have a simple jQuery script in a WordPress plugin that is using a jQuery wrapper like this:

$(document).ready(function(){

    // jQuery code is in here

}         


        
16条回答
  •  天命终不由人
    2020-11-22 02:56

    var $=jQuery.noConflict();
    
    $(document).ready(function(){
        // jQuery code is in here
    });
    

    Credit to Ashwani Panwar and Cyssoo answer: https://stackoverflow.com/a/29341144/3010027

提交回复
热议问题