Twitter Bootstrap Datepicker within modal window

后端 未结 22 1823
旧时难觅i
旧时难觅i 2020-11-29 02:42

I am currently using the Twitter Bootstrap framework, and when using the modal windows I cannot get over js elements to work like datepicker or validation, though chosen and

22条回答
  •  旧巷少年郎
    2020-11-29 03:24

    try use this code it works for me. by the way it came from this site https://github.com/eternicode/bootstrap-datepicker/issues/464 .

    $('#datepicker').datepicker().on('show', function () {
                    var modal = $('#datepicker').closest('.modal');
                    var datePicker = $('body').find('.datepicker');
                    if (!modal.length) {
                        $(datePicker).css('z-index', 'auto');
                        return;
                    }
                    var zIndexModal = $(modal).css('z-index');
                    $(datePicker).css('z-index', zIndexModal + 1);
                });
    

提交回复
热议问题