2013-06-28 35 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加载它。