开发者

jQuery datepicker keeps reopening in IE

jQuery's datepick开发者_StackOverflow中文版er keeps reopening after clicking on a date in IE 8, even on their demo page:

http://jqueryui.com/demos/datepicker/

Does anyone know how to fix this? I don't know about the demo page, but I am having the exact same problem with jQuery 1.6.2 and jQuery UI 1.8.15.

Also, setting the minDate and maxDate options does not seem to have any effect in IE 8. The above seems to also be true with IE 7.


The following resolved this issue for me (using jQuery 1.7.2 / jQueryUI 1.8.20)

var $input = $('#date');

$input.datepicker({
  /* 
   * your other settings here 
   */
  onSelect : function() { $input.blur(); },
  onClose  : function() { $input.change(); }
});

$input.on('change paste', function(evt) {
  // process new date input here
});


1.8.14 works fine in IE8.

The re-opening seems to be a bug in 1.8.15, see broken demo.


I had the same issue with IE8 and the customized min version of Jquery UI 1.8.16 (all options selected) When I used the full released version of 1.8.16 the problem went away.


We are facing the same problem for jquery ui 1.11.2. The following snippet solved the problem in our case:

var input = $('<input>');

input.datepicker({
  onSelect: function() {
    this.lastShown = new Date().getTime();
  },
  beforeShow: function() {
    var time = new Date().getTime();
    return this.lastShown === undefined || time - this.lastShown > 500;
  }
});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜