本文介绍了未捕获的TypeError:undefined不是加载jquery-min.js的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个普通网页,需要我加载大约五个CSS文件和十个Javascript文件。

I'm building a normal webpage which requires me to load about five CSS files and ten Javascript files.


  • 单独加载时在HTML页面中,我的网页加载正常。

  • 现在进行制作,我将所有Javascript连接到一个文件中,按所需顺序连接,并将所有CSS连接到另一个文件中。但是当我尝试使用连接文件运行网页时,它会抛出一个错误:

  • When loading them separately in the HTML page, my webpage loads fine.
  • Now for production, I concatenated all the Javascript into a single file, in the order needed, and all the CSS into another file. But when I try to run the web page with the concatenated files it throws an error saying:

未捕获TypeError:undefined不是函数

在连接的Javascript文件中加载jquery.min.js的行。

On the line where jquery.min.js is being loaded in the concatenated Javascript file.

我可以做些什么来缓解这种情况?我想连接所有文件并缩小它们以进行生产。请帮忙。

What can I do to mitigate this? I want to concatenate all files and minify them for production. Please help.



编辑:我按照加载时的顺序合并了Javascript和CSS单独工作正常。


I merged the Javascript and CSS in the order they were when they were being loaded individually and were working fine.

推荐答案

假设这个问题仍未解决,很多单个文件都没有结束用分号代码。大多数jQuery脚本以(jQuery)结尾,你需要(jQuery);

Assuming this problem still has not be resolved, a lot of individual files don't end their code with a semicolon. Most jQuery scripts end with (jQuery) and you need to have (jQuery);.

作为单独的文件,脚本将加载得很好,但作为一个单独的文件,你需要分号。

As separate files the script will load just fine but as one individual file you need the semicolons.

这篇关于未捕获的TypeError:undefined不是加载jquery-min.js的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 04:43