最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQueryjQueryUI conflict - Stack Overflow

programmeradmin4浏览0评论

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

  1. Two files for autoplete are

    <script type="text/javascript" src=".4.2/jquery.min.js"></script>
    <script type="text/javascript" src=".8.1/jquery-ui.min.js"></script>  
    
  2. One file for Calender datetime picker is:

    <script  src="../assets/js/jquery-1.8.3.min.js"></script> 
    

These 3 files are confilicting when i ment date time picker file autoplete works and if I unment it autoplete stops.

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

  1. Two files for autoplete are

    <script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>  
    
  2. One file for Calender datetime picker is:

    <script  src="../assets/js/jquery-1.8.3.min.js"></script> 
    

These 3 files are confilicting when i ment date time picker file autoplete works and if I unment it autoplete stops.

Share Improve this question edited Mar 13, 2013 at 10:52 Paul Lammertsma 38.3k16 gold badges137 silver badges189 bronze badges asked Mar 13, 2013 at 10:46 user2164964user2164964 2
  • 2 You should be including only ONE version of jQuery per page, and it should be the latest. Working with 1.4.2 and jQueryUI 1.8.1 is asking for trouble. – ahren Commented Mar 13, 2013 at 10:49
  • why using older version for autoplete? – Jai Commented Mar 13, 2013 at 10:49
Add a ment  | 

3 Answers 3

Reset to default 9

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

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

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

No need to add other versions of jquery.

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

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

发布评论

评论列表(0)

  1. 暂无评论