我添加到页面中的jQuery日期选择器在IE 9和Firefox 18中按预期工作,但在Google Chrome 24中选择日期后不会关闭。
这是我正在使用的jQuery代码:
$(function() {
$( "#fromCheck" ).datepicker({
defaultDate: "-1w",
maxDate: "+0",
changeMonth: true,
numberOfMonths: 1,
showButtonPanel: false,
onClose: function( selectedDate ) {
$( "#toCheck" ).datepicker( "option", "minDate", selectedDate || "-1w" );
}
});
$( "#toCheck" ).datepicker({
defaultDate: "+0",
maxDate: "+0",
changeMonth: true,
numberOfMonths: 1,
showButtonPanel: false,
onClose: function( selectedDate ) {
$( "#fromCheck" ).datepicker( "option", "maxDate", selectedDate || "+0" );
}
});
$( "#fromCard" ).datepicker({
defaultDate: "-1w",
maxDate: "+0",
changeMonth: true,
numberOfMonths: 1,
showButtonPanel: false,
onClose: function( selectedDate ) {
$( "#toCard" ).datepicker( "option", "minDate", selectedDate || "-1w" );
}
});
$( "#toCard" ).datepicker({
defaultDate: "+0",
maxDate: "+0",
changeMonth: true,
numberOfMonths: 1,
showButtonPanel: false,
onClose: function( selectedDate ) {
$( "#fromCard" ).datepicker( "option", "maxDate", selectedDate || "+0" );
}
});
});
以下是演示页面的链接:
答案 0 :(得分:0)
你在第136行抛出了一个javascript错误,即停止执行你的Javascript。
违规行是:
<input name="FROMDATE" type="text" id="fromCheck" value="01/04/2013" onfocus="value='" size="10" maxlength="50" />
应该是:
<input name="FROMDATE" type="text" id="fromCheck" value="01/04/2013" onfocus="value=" size="10" maxlength="50" />