首页 > 请问一个datepicker不显示的问题

请问一个datepicker不显示的问题

刚开始学js,我使用的是 http://foxrunsoftware.github.io/DatePicker/一个js插件,下面是代码,直接copy官网的demo,运行后,点击输入框,没有出现日期,查了半天,都没查到。。求助!!

 
<html>
<title>test</title>
<head>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="./datepicker/js/datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="./datepicker/css/base.css" />
<link rel="stylesheet" type="text/css" href="./datepicker/css/clean.css" />

<script>
$('#inputDate').DatePicker({
  mode: 'single',
  position: 'right',
  onBeforeShow: function(el){
    if($('#inputDate').val())
      $('#inputDate').DatePickerSetDate($('#inputDate').val(), true);
  },
  onChange: function(date, el) {
    $(el).val((date.getMonth()+1)+'/'+date.getDate()+'/'+date.getFullYear());
    if($('#closeOnSelect input').attr('checked')) {
      $(el).DatePickerHide();
    }
  }
});

</script>
</head>
<body>
    <input id="inputDate" class="inputDate" value="" >
    <label id="closeOnSelect" class="checkbox"><input type="checkbox" checked="checked"> Close on selection</label>
</body>
</html>

在chrome调试下报这个错

$.curCSS is not a function

原因是你的jquery版本太高了,curCSS是已被废弃的方法,把jquery源换成1.7.1就好了

<script src="http://cdn.bootcss.com/jquery/1.7.1/jquery.min.js"></script>

这个插件太老了,换别的吧

【热门文章】
【热门文章】