[英]What's the proper way to use jQuery in conjunction with 'use strict'?
如果我有以下内容
"use strict";
$(document).ready(function () {
});
我得到警告
'$'is not defined
( function ( $ ) {
'use strict';
$( document ).ready( function () {
console.log( 'working!' )
})
} ( jQuery ) )
您是否将jQuery添加到您的网站?
在tinker.io上尝试相同的代码会产生错误,但随后添加jQuery lib并消除了错误。
CDN: http : //ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
使用此代码段添加
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.