Use jQuery DatePicker in Bootstrap 3 modal

后端 未结 3 640
花落未央
花落未央 2021-02-06 17:42

I would like to use jQuery UI datepicker in a modal. The real problem is that if I want to also show years and months, it shows me empty selects:

3条回答
  •  日久生厌
    2021-02-06 18:08

    I found the solution with this answer. The only option you needed is enforceFocus.

    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
    $.fn.modal.Constructor.prototype.enforceFocus = function() {};
    

提交回复
热议问题