Implementing jQuery DatePicker in Bootstrap modal

后端 未结 7 1237
别那么骄傲
别那么骄傲 2020-12-01 13:41

Created jsfiddle for my issue http://jsfiddle.net/sudiptabanerjee/93eTU/

In modal window issue is on Change Month and Change Year combos.

a) IE 11: everythin

相关标签:
7条回答
  • 2020-12-01 14:43

    This is because the modal enforces focus on itself. Here is a solution for this as mentioned here . Add the below script to your js file. That's it.

    Working Demo

    jQuery

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

    For Bootstrap 4:

    replace : $.fn.modal.Constructor.prototype.enforceFocus
    By: $.fn.modal.Constructor.prototype._enforceFocus
    
    0 讨论(0)
提交回复
热议问题