This is the "main" code I'm using;
$(function(){
var initDatepickers = function(){
var $entrada = $('#form-disponibilidad [name=llegada]');
var $salida = $('#form-disponibilidad [name=salida]');
$entrada.datepicker({
'onSelect': function (str, obj) {
var tmpDateObj = $entrada.datepicker('getDate');
/* Actualizar selects */
$(this).datepicker("hide");
},
'minDate': 1,
showOn: "button",
buttonImage: "http://next.cabauhotels.com/img/iconos/pixel.png",
buttonImageOnly: true,
dateFormat: 'yy-mm-dd'
});
$salida.datepicker({
'onSelect': function () {
var tmpDateObj = $salida.datepicker('getDate');
datepickerToselect(tmpDateObj,'end');
$(this).datepicker("hide");
},
'minDate': 2,
showOn: "button",
buttonImage: "http://next.cabauhotels.com/img/iconos/pixel.png",
buttonImageOnly: true,
dateFormat: 'yy-mm-dd'
});
}
initDatepickers();
});
the problem is that after selecting a date, the calendar is never hidden in IE8
I see this error in the console:
Any idea how to solve this and keep the input hidden?
-EDIT-
I found this workaround
if($.browser.msie && parseInt($.browser.version,10) < 9){
$('#ui-datepicker-div').hide();
}else{
$(this).datepicker("hide");
}
But it would be great to prevent errors in console, any thoughts?