When seajs is used, the following error occurs: Uncaught ReferenceError: $ is not defined, seajsuncaught.

Source: Internet
Author: User

When seajs is used, the following error occurs: Uncaught ReferenceError: $ is not defined, seajsuncaught.

This problem does not occur when jquery is referenced when seajs is not modularized.

Later, when using seajs for modularization and introducing the jquery plug-in, the following errors were reported:

1. The file path in the jquery library is incorrect. You can solve this problem by checking whether the file path is correct.
2. If the path of the library file is correct, the sequence of loading jquery library files in html may be incorrect. If you load the jquery library file to the initial position, this error can be solved.

Then I put the jquery library file in html, but I still want to use seajs to manage jquery and don't want to expose jquery to the outside. So I used the following method:

Write in the module file:

Window. jQuery = window. $ = require ("jquery ");
I tried it. It is feasible. I don't know if you have any better solutions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.