TypeError: 'undefined' is not a function (evaluating '$(document)')

前端 未结 14 1896
猫巷女王i
猫巷女王i 2020-11-22 07:13
  1. I\'m using a WordPress site.
  2. I\'m including this script in the header.

When the script loads, I get this error:

TypeErro

14条回答
  •  灰色年华
    2020-11-22 07:42

    You can pass $ in function()

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

    or you can replace $(document); with this jQuery(document);

    or you can use jQuery.noConflict()

    var jq=jQuery.noConflict();
    jq(document).ready(function(){  
      jq('selector').show();
    });
    

提交回复
热议问题