Add jquery and seajsjquery to seajs 2.3.0

Source: Internet
Author: User

Add jquery and seajsjquery to seajs 2.3.0

[Preface]

The previous article briefly introduced the use of seajs. In the afternoon, I encountered a problem when using seajs to integrate jquery.

Download examples from seajs, and directly require ('jquery ') has no problem,

I wrote it again, but I reported that $ is not defined ..

Find this blog to solve the problem:

Http://blog.csdn.net/adeyi/article/details/18003043

Thank you very much.


[Reason]

Js in seajs is a module that loads jquery directly. This jquery is not modularized,

Yes, jquery in examples is modular ..


[Solution]

Write a jquery. js file by yourself. The Code is as follows:

That is, copy the jquery source code and add a return


[Example]

Page:

<! DOCTYPE html> Js:

define(function(require, exports, module) {var $ = require('jquery');var s = $('#test').attr('data');alert(s);});

Effect:


Well, seajs of the potholes does not have a pdf document. It is a bit east and west...


How does seajs call the jquery plug-in?

I have asked the author of seajs, yuber's predecessors, to rewrite this question. The plug-in cannot pollute jquery's $ or $. fn. Otherwise, repeated calls may occur.
 
Failed to load jquery due to seajs issues

Seajs needs to transform jquery because native jquery does not provide interfaces to it. We recommend that you use AMD requireJS.

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.