jQuery/jQueryUI conflict

前端 未结 3 594
闹比i
闹比i 2020-12-10 17:31

I am using some jquery files for auto complete and datetime picker control but 3 files among them are conflicting:

  1. Two files for autocomplete are

             
    
    
            
相关标签:
3条回答
  • 2020-12-10 18:20

    That's probably because you are including jQuery 2 times. An old version and a newer version.

    I would recommend you try and use the most recent versions of both jQuery and jQuery UI and check if everything still works.

    0 讨论(0)
  • 2020-12-10 18:35

    If you want to include both the js files you can..

     <!-- load jQuery 1_8_3 -->
        <script  src="../assets/js/jquery-1.8.3.min.js"></script> 
        <script type="text/javascript">
        var jQuery_1_8_3 = $.noConflict(true);
        </script>
    
        <!-- load jQuery 1.4.2 -->
        <script type="text/javascript" src="jquery/jquery-1.4.2.js"></script>
        <script type="text/javascript">
        var jQuery_1_4_2= $.noConflict(true);
        </script>
    

    Its better to avoid multiple versions in the page..and its better to use appropriate jquery-UI Version with the jquery version

    0 讨论(0)
  • 2020-12-10 18:38

    If you try only these, i think you are good to go:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js">
    </script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js">
    </script>
    

    No need to add other versions of jquery.

    0 讨论(0)
提交回复
热议问题