如果我使用 defer,它会产生 3 个这样的错误:Uncaught ReferenceError: $ is not defined, Uncaught TypeError: $(...).material_select 不是函数,并且 Uncaught TypeError: $(...).select2 is not a function
If I using defer, it make 3 error like this : Uncaught ReferenceError: $ is not defined, Uncaught TypeError: $(...).material_select is not a function, and Uncaught TypeError: $(...).select2 is not a function
我该如何解决这个错误?
How can I solve this error?
推荐答案
你有上面提到的两个错误,Uncaught ReferenceError: $ is not defined, Uncaught TypeError: $(...).material_select is not a函数和未捕获的类型错误:$(...).select2 不是函数
You have two errors as mentioned above, Uncaught ReferenceError: $ is not defined, Uncaught TypeError: $(...).material_select is not a function, and Uncaught TypeError: $(...).select2 is not a function
第一个问题可以通过在任何其他js之前添加以下js文件来解决,如下所示
the first problem can be resolved by adding the following js file on the top before any other js as shown below