Datepicker返回未捕获typeError:undefined'currentDay' [英] Datepicker returning uncaught typeError: undefined 'currentDay'

查看:234
本文介绍了Datepicker返回未捕获typeError:undefined'currentDay'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用jQuery UI和Bootstrap,我似乎遇到了一个我以前没有的问题。我不知道发生了什么变化我已经尝试安装了不同版本的jQuery,同时我没有更新jQuery UI。所以我不知道是什么破坏了。

I've been using jQuery UI with Bootstrap and I seem to run into a problem that I haven't had before. I'm not sure what has changed; I've tried setting back different version of jQuery and I didn't update the jQuery UI in the meanwhile. So I'm not exactly sure what broke.

当我点击datepicker中的任何日期时,控制台的错误返回:

The error from the console when I click on any date in the datepicker returns:

Uncaught TypeError: Cannot set property 'currentDay' of undefined 

代码相当直截了当,因为可以期望从日期戳:

The code is fairly straightforward as one would expect from a datepicker:

$(".datepicker").datepicker({
dateFormat: 'dd-mm-yy'
}); 

使用以下HTML:

<input type="text" class="datepicker" />

这是一个应该报告的错误(因为没有其他的Google匹配)我已经错过了吗?

Is this a bug that should be reported (since no other Google matches turn up) or is it something else I've missed?

推荐答案

我找到了解决方案。经过很长时间的调试,我发现有一个< div> 具有完全相同的 ID 比输入字段高。因此,脚本采用包含 ID 的第一个实例,并选择了 DIV 而不是输入字段。

I've found the solution. After a long time of debugging I figured out that there was a <div> that had the exact same ID, lying higher than the input field. Therefore the script took the first instance that contained the ID and picked the DIV instead of the input field.

我删除/重命名了 DIV ,它再次正常工作。

I removed/renamed the DIV and it worked fine again.

这篇关于Datepicker返回未捕获typeError:undefined'currentDay'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆