本文介绍了datepicker和jstree或multipul之间的冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的页面中使用datepicker

i use datepicker in my page

我使用jquery 1.6.2和jquery UI 1.8.14工作的datepicker

datepicker that i used work with jquery 1.6.2 and jquery UI 1.8.14

然后我使用jstree使用1.9.0或更高版本

then i use jstree that work with 1.9.0 or greater

和多选择至少1.7.0 jquery

and Multiple Select with at least 1.7.0 jquery

我加载这些js文件

<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>

<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
var jq162 = jQuery.noConflict(true);
</script>

<script type="text/javascript" src="scripts/jquery-ui-1.10.42.custom.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="js/jquery-ui.css" />
<script type="text/javascript" src="scripts/jquery.ui.datepicker-cc2.all.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon2.js"></script>
<link href="js/multiple-select.css" rel="stylesheet"/>
<script src="js/jstree.min.js"></script>
<link rel="stylesheet" href="js/themes/style.min.css" />

现在我使用这个

   <script type="text/javascript">
      jq162(function() {
        //----------------------------------
        jq162('#datepicker12from').datepicker({
          onSelect: function(dateText, inst) {
            jq162('#datepicker12to').datepicker('option', 'minDate', new JalaliDate(inst['selectedYear'], inst['selectedMonth'], inst['selectedDay']));
          }
      });
      jq162('#datepicker12to').datepicker();
      jq162('#datepicker').datepicker();
    });
</script>

而且与此代码datepicker不工作

but also with this codes datepicker don't work

我可以为这个问题做些什么?

what can i do for this problem?

请帮助我,如果可以,我真的需要解决这个程序

please help me if you can, i really need solve this program

谢谢

推荐答案

这里最简单的解决方案是使用较新的jQuery库作为 DatePicker 仍然可以正常工作。

The easiest solution here is to use the newer jQuery library, as the DatePicker would still work fine.

但是...

根据您尝试使用 .noConflict()的工作:

There's a work around based on what you've tried using .noConflict():

HTML

<-- Leave the jsTree library out of here -->
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="js/jquery-ui.css" />
<script type="text/javascript" src="scripts/jquery-ui-1.10.42.custom.js"></script>
<script type="text/javascript" src="scripts/jquery.ui.datepicker-cc2.all.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon2.js"></script>
<link href="js/multiple-select.css" rel="stylesheet"/>
<link rel="stylesheet" href="js/themes/style.min.css" />

jQuery(Javascript)

var jq162 = jQuery.noConflict(true);

// For debugging.
// You can see which version is loaded where.
console.log(jq162.fn.jquery);
console.log($.fn.jquery);

jq162(function () {
    jq162('#datepicker12from').datepicker();
});

$(function () {
    // Load the jsTree script library here.
    $.getScript('js/jstree.min.js', function () {
        // When it's done loading, create your jsTree stuff.
        $('#jstree1').jstree();
    });
});

这篇关于datepicker和jstree或multipul之间的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 06:14