2017-06-29 108 views
0

我正在嘗試修改Jquery日曆以顯示月份和年份菜單以及在其他月份顯示日期。在JQuery日曆中顯示日期以及其他月份和月份和年份菜單

其他月份爲顯示日期的代碼是:

<script> 
    $(function() { 
    $("#datepicker").datepicker({ 
     showOtherMonths: true, 
     selectOtherMonths: true 
    }); 
    }); 
    </script> 

的代碼來顯示月和yearis:

<script> 
    $(function() { 
    $("#datepicker").datepicker({ 
     changeMonth: true, 
     changeYear: true 
    }); 
    }); 
    </script> 

當我嘗試都它不工作結合起來,是一個bug在無法修復的日曆中?

<script> 
    $(function() { 
    $("#datepicker").datepicker({ 
     showOtherMonths: true, 
     selectOtherMonths: true 

     changeMonth: true, 
     changeYear: true 
    }); 
    }); 
    </script> 

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> 
 
    <link rel="stylesheet" href="///code.jquery.com/resources/demos/style.css"> 
 
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
 
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
 
    <script> 
 
    $(function() { 
 
    $(".myDatepicker").datepicker({ 
 
     showOtherMonths: true, 
 
     selectOtherMonths: true, 
 
     changeMonth: true, 
 
     changeYear: true 
 
    }); 
 
    }); 
 
    </script> 
 

 
    
 
<p>Date: <input type="text" id="datepicker1" class="myDatepicker"></p> 
 
fsdfsdfsd 
 
    
 
sdf 
 
sdf 
 
sdf 
 
    
 
<p>Date: <input type="text" id="datepicker2" class="myDatepicker"></p> 
 
    
 
    fsdfsdfsd 
 
    
 
sdf 
 
sdf 
 
sdf 
 
<p>Date: <input type="text" id="datepicker3" class="myDatepicker"></p>

enter image description hereenter image description here

我想這兩個結合起來。

+1

[做工精細這裏(http://plnkr.co/edit/gH6ZsKx6XFFMvbZePExL?p=preview)當有muliple都 – charlietfl

+0

@charlietfl不工作相結合日曆

日期:

日期: user580950

+1

修改演示,以證明它不靈 – charlietfl

回答

0

改變了代碼,以跟蹤和工作

<script> 
    $(function() { 
    $("#datepicker").datepicker({ 
     showOtherMonths: true, 
     selectOtherMonths: true,  
     changeMonth: true, 
     changeYear: true 
    }); 
    }); 
    </script> 
相關問題