jQuery Datepicker在IE7中关闭时一直显示

jQuery Datepicker在IE7中关闭时一直显示

问题描述:

当点击完成按钮时,我遇到了datepicker不断重新出现的问题。但只有在IE7中,不是Firefox - 它保持隐藏状态。我怀疑问题是datepicker显示在焦点上,当datepicker关闭时主机输入正在IE中重新聚焦,触发它重新出现。jQuery Datepicker在IE7中关闭时一直显示

JQ 1.3.2(也试过1.4.2)JQUI 1.7.2。

$(".period").datepicker({ 
    clickInput: true, 
    dateFormat: 'MM yy', 
    changeMonth: true, 
    changeYear: true, 
    showButtonPanel: true, 
    onClose: function(dateText, inst) { 
     ... 
     $(this).datepicker('setDate', new Date(year, month, 1)); 
    } 
}); 
+0

我与使用jQuery 1.5和JQUI 1.8.9看到。 – 2011-02-18 04:14:18

这里的修复(改编自this jQuery forum thread): 变化

$(this).datepicker('setDate', new Date(year, month, 1)); 

$(this).val($.datepicker.formatDate('MM yy', new Date(year, month, 1))); 
+0

非常感谢非常感谢! – Dan 2011-10-14 19:56:27