Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
345 views
in Technique[技术] by (71.8m points)

javascript - Uncaught TypeError: undefined is not a function on loading jquery-min.js

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

  • 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:

    Uncaught TypeError: undefined is not a function

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.


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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...