Home  >  Article  >  Web Front-end  >  jQuery库与其他JS库冲突的解决办法_jquery

jQuery库与其他JS库冲突的解决办法_jquery

WBOY
WBOYOriginal
2016-05-16 18:35:131065browse
复制代码 代码如下:





记得要在载入完各js库后才能用jQuery.noConflict()进行重载哦,如例子中的prototype和jquery。

当然我们也可以不使用其默认的名字空间,比如我喜欢使用 $j() 而不是 jQuery() 。

Js代码
复制代码 代码如下:

var $j = jQuery.noConflict();
$j(document).ready(function(){
$j(”div”).hide();
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn