日期选择器返回未捕获的 typeError: undefined 'currentDay' [英] Datepicker returning uncaught typeError: undefined 'currentDay'

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

问题描述

我一直在使用带有 Bootstrap 的 jQuery UI,但似乎遇到了一个我以前从未遇到过的问题.我不确定发生了什么变化;我尝试设置回不同版本的 jQuery,但同时我没有更新 jQuery UI.所以我不确定是什么坏了.

单击日期选择器中的任何日期时控制台返回的错误:

未捕获的类型错误:无法设置未定义的属性currentDay"

正如人们对日期选择器所期望的那样,代码相当简单:

$(".datepicker").datepicker({日期格式:'dd-mm-yy'});

使用以下 HTML:

这是一个应该报告的错误(因为没有其他 Google 匹配出现)还是我遗漏了什么?

解决方案

我找到了解决方案.经过长时间的调试,我发现有一个

具有完全相同的 ID,位于输入字段的上方.因此,脚本采用包含 ID 的第一个实例并选择 DIV 而不是 input 字段.

我删除/重命名了 DIV 并且它再次正常工作.

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.

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'
}); 

With the following HTML:

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

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

解决方案

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.

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

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

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