简体   繁体   中英

Conflict between jQuery and another js

I added this following script to my html without any problem:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM