This is how the jQuery library script files are connected:

<head> .... <title></title> <script src="/js/jquery-3.2.1.js"></script> <script src="/js/jquery-ui.js"></script> <script src="/js/select2.full.js"></script> .... 

when creating a select2 object (converting from the normal select to select2) I get an error in the console

TypeError: $ (...). Select2 is not a function

you remove the string

 <script src="/js/jquery-ui.js"></script> 

and the error disappears. But UI widgets stop working (tabs, etc ..)

And you need everything to work and UI and Select2

I can not understand where the cause of this conflict

PS lines:

 <script src="/js/jquery-ui.js"></script> <script src="/js/select2.full.js"></script> 

changed places and did not help

    1 answer 1

    In this example, jquery-ui works in conjunction with select2.

    Check whether the select2.full.js script is loaded correctly .

    Also, the problem may be incompatible versions. In my example, the following scripts are used:

     <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.min.js"></script> 

    Including, css styles for jquery-ui and select2 must also be connected.