jQuery UI DatePicker to show month year only(jQuery UI DatePicker 仅显示月份年份)
问题描述
我正在使用 jQuery 日期选择器在整个应用程序中显示日历.我想知道是否可以使用它来显示月份和年份(2010 年 5 月)而不是日历?
I am using jQuery date picker to display the calendar all over my app. I want to know if I can use it to display the month and year (May 2010) and not the calendar?
推荐答案
这是一个 hack(更新了整个 .html 文件):
Here's a hack (updated with entire .html file):
编辑上面例子的jsfiddle:http://jsfiddle.net/DBpJe/7755/
EDIT jsfiddle for the above example: http://jsfiddle.net/DBpJe/7755/
编辑 2仅在单击完成按钮时才将月份年份值添加到输入框中.还允许删除输入框值,这在上述字段中是不可能的http://jsfiddle.net/DBpJe/5103/
EDIT 2 Adds the month year value to input box only on clicking of Done button. Also allows to delete input box values, which isn't possible in above field http://jsfiddle.net/DBpJe/5103/
编辑 3更新了基于 rexwolf 的解决方案的更好的解决方案.
http://jsfiddle.net/DBpJe/5106
EDIT 3
updated Better Solution based on rexwolf's solution down.
http://jsfiddle.net/DBpJe/5106
这篇关于jQuery UI DatePicker 仅显示月份年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!