jQuery datepicker keeps reopening in IE

jQuery's datepicker 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.

Upvotes: 5

Views: 5975

Answers (4)

Stefan Zugal
Stefan Zugal

Reputation: 11

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;
  }
});

Upvotes: 1

Cory Martin
Cory Martin

Reputation: 101

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
});

Upvotes: 8

BuildFailure
BuildFailure

Reputation: 11

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.

Upvotes: 1

andyb
andyb

Reputation: 43823

1.8.14 works fine in IE8.

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

Upvotes: 1

Related Questions