Add jquery to seajs 2.3.0

Source: Internet
Author: User

Add jquery 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] <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + 0rPD5qO6PC9wPgo8cD48cHJlIGNsYXNzPQ = "brush: java;"> Seajs-demo-04 <Script type = "text/javascript" src = "$ {base}/ZJS/sea. js "> </script> <script type =" text/javascript "> seajs. config ({alias: {'jquery ': 'jquery/jquery. js '}); seajs. use ('demo04. js'); </script>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...

Related Article

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.