2014-02-05 13 views
0

我用DatePicker的引導模式中:JQuery的日期選擇器changeYear內模態

$.datepicker.setDefaults($.datepicker.regional['it']); 

$("#datepicker").datepicker({showOn:"button",dateFormat: 'dd-mm-yy', 
    changeYear: true, 
    yearRange:'1920:+0', 
    buttonImageOnly: true, 
    buttonImage: '/icon-datepicker.png' 

}).on('change',function(){ 
    $(this).blur() 
}); 

但是,當我從下拉框中選擇一年,模態消失。爲什麼?

回答

1

我在SO找到了解決方案。我轉貼的代碼是:

// Since confModal is essentially a nested modal it's enforceFocus method 
// must be no-op'd or the following error results 
// "Uncaught RangeError: Maximum call stack size exceeded" 
// But then when the nested modal is hidden we reset modal.enforceFocus 
var enforceModalFocusFn = $.fn.modal.Constructor.prototype.enforceFocus; 

$.fn.modal.Constructor.prototype.enforceFocus = function() {}; 

    $confModal.on('hidden', function() { 

    $.fn.modal.Constructor.prototype.enforceFocus = enforceModalFocusFn; 
}); 

$confModal.modal({ backdrop : false });