2013-06-28 37 views
0

我在我的頁面上有jQuery Datepicker。當我選擇價值時,它不能同時在URL上添加#。我不理解這個問題。我做了如下,jquery Datepicker css或腳本問題

$("#AsOfDate").datepicker({ 
       minDate: new Date(1900, 01, 01), 
       maxDate: new Date(), 
       changeMonth: true, 
       changeYear: true, 
      }); 

任何人都有想法。

+0

在控制檯上看到一次。是否有錯誤? – PSR

+0

您應該在changeYear:true之後移除最後的',',因爲之後您沒有任何選項。 –

回答

0

試試這個

<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>jQuery UI Datepicker - Default functionality</title> 
     <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> 
     <script src="http://code.jquery.com/jquery-1.9.1.js"></script> 
     <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 
     <link rel="stylesheet" href="/resources/demos/style.css" /> 
     <script> 
     $(function() { 
     $("#AsOfDate").datepicker({ 
        dateFormat: 'yy-mm-dd', 
        yearRange: '1900:2012', 
        monthRange: '01:12', 
        minDate: new Date('1900/01/01'), 
        maxDate: '+30Y, 
        changeMonth: true, 
        changeYear: true 
       }); 
     }); 
     </script> 
    </head> 
    <body> 

    <p>Date: <input type="text" id="AsOfDate" /></p> 


    </body> 
    </html> 

確保jQuery和jQuery UI的加載正確,則嘗試從CDN加載它。