只有在这个代码的IE中
@H_403_2@$('#datepicker').datepicker({
onSelect : function(x,u){
$(this).focus();
}
});
当我选择一个日期时,datepicker会重新打开,因为我添加了$(this).focus();在onSelect.我该如何解决这个问题? (Example)
我使用jquery 1.8.2和jquery-ui 1.9
解决方法
这是我可以得到的最好的解决方法:
(灵感来自this link)
@H_403_2@$('#datepicker').datepicker({ /* fix buggy IE focus functionality */ fixFocusIE: false,onSelect: function(dateText,inst) { this.fixFocusIE = true; $(this).change().focus(); },onClose: function(dateText,inst) { this.fixFocusIE = true; this.focus(); },beforeShow: function(input,inst) { var result = $.browser.msie ? !this.fixFocusIE : true; this.fixFocusIE = false; return result; } }).click(function(){$(this).focus()});请注意,您在问题中建议,im使用jquery-UI 1.9.0.在您的示例中,您使用的是jquery-ui 1.8.15,它已知在某些事件(例如IE上的ShowShow()之前)是错误的.