TypeError: $ is not a function when calling jQuery function

后端 未结 16 2029
慢半拍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 03:14

    Use

    jQuery(document).
    

    instead of

    $(document).
    

    or

    Within the function, $ points to jQuery as you would expect

    (function ($) {
       $(document).
    }(jQuery));
    

提交回复
热议问题