他所有我正在使用datepicker的这个功能,这是好的,但我想要它只是在id datepicker1完全callender显示日期月和年,但对于其余的ids datepicker2直到datepicker11只有月和年显示与完成按钮。非常感谢你的帮助
这是我的代码
<script>
$(function() {
$( "#datepicker1, #datepicker2, #datepicker3, #datepicker4, #datepicker5, #datepicker6, #datepicker7, #datepicker8, #datepicker9, #datepicker10,#datepicker11").addClass('datepicker');
$( ".datepicker" ).datepicker({ dateFormat: "dd-M-yy", changeMonth: true, changeYear: true, yearRange: "1947:" });
});
</script>
答案 0 :(得分:1)
您可以将类datepicker
添加到除#datepicker1
之外的所有日期选择工具ID,然后执行以下操作:
$("#datepicker2, #datepicker3, #datepicker4, #datepicker5, #datepicker6, #datepicker7, #datepicker8, #datepicker9, #datepicker10,#datepicker11").addClass('datepicker');
$(".datepicker").datepicker({
dateFormat: "M-yy",
changeMonth: true,
changeYear: true,
showButtonPanel: true,
yearRange: "1947:"
});
$(".datepicker").focus(function() {
$(".ui-datepicker-calendar").hide();
$("#ui-datepicker-div").position({
my: "center top",
at: "center bottom",
of: $(this)
});
});
$("#datepicker1").datepicker({
dateFormat: "dd-M-yy"
});