我正在使用Jquery日期选择器。我只是想在弹出日历时显示日历,但我不希望它被选中(就像使用setDate函数时一样)。
我的日期拣货员:
$('#<%=effdatepicker.ClientID%>').datepicker({
changeMonth: false,
changeYear: false,
minDate: cutoff,
showOn: "both",
buttonImageOnly: true,
buttonText: "Select date",
}).attr('readonly', 'readonly');
});
&#13;
<asp:TextBox ID="effdatepicker" Width="100px" runat="server" ClientIDMode="Static"></asp:TextBox>
&#13;
答案 0 :(得分:0)
你的意思是你只想在日历中显示今天的日期,但不允许更改?如果是的话:
$('#<%=effdatepicker.ClientID%>').datepicker({
changeMonth: false,
changeYear: false,
minDate: 0,
maxDate: 0,
showOn: "both",
buttonImageOnly: true,
buttonText: "Select date",
}).attr('readonly', 'readonly');
答案 1 :(得分:0)
检查此fiddle
onSelect: function(dateText, inst) {
var date = $(this).datepicker('getDate');
var dayOfWeek = weekday[date.getUTCDay() + 1];
var selectedMonthName = months[$("#CheckInDate").datepicker('getDate').getMonth()];
$('#checkInDateDiv').html(dateText.split('/')[1]);
var dayandady = dayOfWeek + '<br>' + selectedMonthName;
$("#checkInDateSpan").html(dayandady);
var t = $("#CheckInDate").datepicker("getDate");
t.setDate(t.getDate() + 1);
$("#CheckOutDate").datepicker("option", "minDate", t)
},