jQuery ui datepicker仅日期/月份,而不是年份选择 [英] jquery ui datepicker day/month only, not year selection
问题描述
我在这里以及所有地区进行了搜索,但是没有针对此问题的适当解决方案. 使用jQueryUI DatePicker,我需要选择所有年份的递归日期,所以我不想显示年份选择,因为这没有意义.
如何像下面这样在通话中获取此信息?
$('#myInput').datepicker({ dateFormat: "dd/mm" });
注意:此处 .ui-datepicker-year{
display:none;
}
,因为同一页面中还有其他日期选择器.
任何帮助将不胜感激.
谢谢.
尝试此演示: 它在我的便携式OSX中的显示方式: I've searched here in SO and all around but no properly solutions founded for this issue.
With jQueryUI DatePicker I need to select a recursive date for all years, so I don't wanna show year selection, 'cause it doesn't make sense. How can I obtain this inside the call like the following? Note: I can't use css solution as suggested here Any help will be appreciated. Thanks in advance. Try this demo: http://jsfiddle.net/rAdV6/20/ To elaborate further, this fix will allow to have multiple date pickers with or without year on top appear on the top of the calendar. jQuery code: CSS: HTML: How it appears in my lappy OSX: 这篇关于jQuery ui datepicker仅日期/月份,而不是年份选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!$('#myInput').datepicker({ dateFormat: "dd/mm" });
.ui-datepicker-year{
display:none;
}
because there are other datepickers in the same page.
Also see both screenshots below.$('.DateTextBox.NoYear').datepicker({
beforeShow: function (input, inst) {
inst.dpDiv.addClass('NoYearDatePicker');
},
onClose: function(dateText, inst){
inst.dpDiv.removeClass('NoYearDatePicker');
}
});
$('#datepicker').datepicker( { changeYear: false, dateFormat: 'dd/mm',});
$('#datepicker1').datepicker( { changeYear: true, dateFormat: 'dd/mm', });
$('#datepicker2').datepicker( { changeYear: false, dateFormat: 'dd/mm', });
.NoYearDatePicker .ui-datepicker-year
{
display:none;
}
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all">
date (without year) <input type="text" id="datepicker" class="DateTextBox NoYear">
<br />
date 1: (With year) <input type="text" id="datepicker1" >
<br />
date 2: (Without year) <input type="text" id="datepicker2" class="DateTextBox NoYear">