[英]Conflict between jQuery and another js
I added this following script to my html without any problem: 我将以下脚本添加到html中没有任何问题:
<link href="multiselect.css" rel="stylesheet"/>
<script src="multiselect.min.js"></script>
... ...
<script>
document.multiselect('#selection');
</script>
However, as soon as I include this following jQuery, it is said that document.multiselect is not a function
: 但是,一旦我在jQuery中包含以下内容,就可以说
document.multiselect is not a function
:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="multiselect.css" rel="stylesheet"/>
<script src="multiselect.min.js"></script>
Why there would be such a conflict? 为什么会有这样的冲突? How should I resolve?
我应该如何解决?
Add the jQuery line at the very end of your header, which will solve the issue: 在标题的最后添加jQuery行,这将解决问题:
<link href="multiselect.css" rel="stylesheet"/>
<script src="multiselect.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.