当前第2页 返回上一页
如果jQuery在其他js库前,不需要使用noConflict。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <!-- 引入 jquery库 -->
<script src= "jquery-1.11.0.js" ></script>
<script type= "text/javascript" >
var $jq = $;
console.log($.fn.jquery);
</script>
<!-- 引入 其他库-->
<script type= "text/javascript" >
$ = {
fn:{
jquery: "otherJS"
}
};
</script>
<script type= "text/javascript" >
console.log($.fn.jquery);
console.log( $jq .fn.jquery);
</script>
|
如果在其他js库之后,用noConflict让渡。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!-- 引入 其他库-->
<script type= "text/javascript" >
$ = {
fn:{
jquery: "otherJS"
}
};
</script>
<!-- 引入 jquery库 -->
<script src= "jquery-1.11.0.js" ></script>
<script type= "text/javascript" >
console.log($.fn.jquery);
var $180 = $.noConflict();
console.log($.fn.jquery);
console.log( $jq .fn.jquery);
</script>
|
相关免费学习推荐:JavaScript(视频)
以上就是jquery中的$符号冲突怎么解决的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
jQuery怎么转数字
如何判断jQuery class是否存在
jQuery click()和onclick()区别是什么
jQuery如何判断某个属性是否存在hasattr
jq怎么设置css样式
jQuery如何判断浏览器的内核
jQuery如何获取祖先元素
jQuery ajax 提交乱码怎么办
jQuery表示什么?
jQuery blur()怎么用
更多相关阅读请进入《jQuery》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » jquery中的$符号冲突怎么解决