Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Datepicker javascript-无法读取属性';价值';_Javascript_Jquery_Css_Twitter Bootstrap_Datepicker - Fatal编程技术网

Datepicker javascript-无法读取属性';价值';

Datepicker javascript-无法读取属性';价值';,javascript,jquery,css,twitter-bootstrap,datepicker,Javascript,Jquery,Css,Twitter Bootstrap,Datepicker,我想使用datepicekr作为签入-签出,因此我有HTML: <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="datum">Datum: Od</label> <div class="col-md-3"> <input id="dp1" name="dp1" class="form-contr

我想使用datepicekr作为签入-签出,因此我有HTML:

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="datum">Datum: Od</label>  
  <div class="col-md-3">
<input id="dp1" name="dp1" class="form-control" placeholder="Datum" type="text">
  </div>
  <div class="col-md-3">
<input id="dp2" name="dp2" class="form-control" placeholder="Datum" type="text">
  </div>
</div>

那到底是什么意思?我能做些什么来解决这个问题?我使用官方web资源中的datepicker代码进行引导…

基于上提供的示例,javascript运行良好

我唯一能想到的是Javascript库没有加载。
尝试将以下代码行添加到网页(或其本地等效代码)



如果这对您不起作用,请尝试使用小提琴作为出发点,以便在将来提出更具针对性的问题。

这非常明确,您试图在未定义的值上获取属性“valueOf”。是的,但这是来自官方资源的示例,我只是复制代码。。。所以我不知道哪里会出错,这很简单:它可能来自每个访问属性值的地方,也就是说,其中一个日期对象不是日期。
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);

var checkin = $("#dp1").datepicker({
  onRender: function(date) {
    return date.valueOf() < now.valueOf() ? 'disabled' : '';
  }
}).on('changeDate', function(ev) {
  if (ev.date.valueOf() > checkout.date.valueOf()) {
    var newDate = new Date(ev.date)
    newDate.setDate(newDate.getDate() + 1);
    checkout.setValue(newDate);
  }
  checkin.hide();
  $("#dp2")[0].focus();
}).data('datepicker');
var checkout = $("#dp2").datepicker({
  onRender: function(date) {
    return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
  }
}).on('changeDate', function(ev) {
  checkout.hide();
}).data('datepicker');
Uncaught TypeError: Cannot read property 'valueOf' of undefined 
<link rel="stylesheet" type="text/css" href="http://kylemitofsky.com/libraries/libraries/datepicker.css">
<script type="text/javascript" src="http://kylemitofsky.com/libraries/libraries/bootstrap-datepicker.js"></script>