jQuery Date Picker首先选择年份,然后选择月份 [英] jQuery Date Picker Pick Year First and then Month

查看:191
本文介绍了jQuery Date Picker首先选择年份,然后选择月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要进行哪些更改才能在jQuery中首先显示Years下拉列表,然后将Month下拉列表显示为第二个字段,因此用户可以选择自己出生的年份,然后选择该年份的月份.我们仍然希望限制日历显示的日期不能大于今天.

What changes are needed to show the Years dropdown first and then the months dropdown as second field in jQuery so users can select which year they are born and then select the month in that year. We still want to restrict that calendar cannot display date greater than today.

如果用户选择2011,则不应允许他们选择比今天大的日期.

If user selects 2011, they should not be allowed to select date greater than today.

推荐答案

我也在寻找这个,并且到达这里,但是没有解决方案,所以我进入jquery-ui.custom.min.js并找到了一个选项.其如下.希望它能有所帮助,尽管有点晚了.

I was looking for this also and got here but no solution so I get into jquery-ui.custom.min.js and found the an option. Its as below. Hope it helps although its a bit late..

$( "#datepicker_id" ).datepicker({
    showOn: "button",
    buttonImage: "images/calendar.png",
    buttonImageOnly: true,
    dateFormat:'mm-dd-yy',
    changeYear: true,
    changeMonth: true,
    showMonthAfterYear: true, //this is what you are looking for
    maxDate:0
});

但是,如果您发现已经将其张贴在这里了:)

But if you found that already you should have posted it here :)

这篇关于jQuery Date Picker首先选择年份,然后选择月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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