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...