jQuery datepicker年份范围默认值 [英] jquery datepicker year range default

查看:426
本文介绍了jQuery datepicker年份范围默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JQuery datePicker有点问题,我怀疑这只是我忽略或出错的设置的问题.

Having a bit of an issue with the JQuery datePicker, I suspect it's just the matter of a setting I've overlooked or got wrong.

如果您看这个简单的小提琴: JS小提琴

If you look at this simple fiddle: JS Fiddle

您会看到我已经设置了年份范围,因此默认情况下,当您单击输入时,它将在1994年打开它,但是如果您随后单击这些日期中的任何一个,例如9月3日,它实际上仍将输入到2012年,而不是下拉菜单中选择的年份.

You'll see I've set the year range, so that the by default when you click on the input it will open it up on 1994, but if you then click on any of those dates, e.g. 3rd Sept, it'll actually put it in the input as 2012 still, rather than the year that is selected in the drop down menu.

如何使它使用正确的年份,而不必更改下拉菜单,然后再次将其更改回原来的状态?

How can I make it so that it uses the correct year without having to change the drop down and then change it back again?

干杯.

推荐答案

很奇怪,但是在日期选择器选项中添加defaultDate:"1994-01-01"似乎可以解决此问题.

Weird, but adding defaultDate:"1994-01-01" to the datepicker options seems to fix it.

小提琴

这篇关于jQuery datepicker年份范围默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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