javascript - Modal 中的 Bootstrap DatePicker 不起作用

标签 javascript css datepicker modal-dialog

我在模态中有这个日期选择器但不工作。我已经尝试了一些我在论坛上看到的代码,但没有一个有效。这可能是一个javascript问题吗?我不确定是什么让它不显示日期选择器,任何可以帮助我的人都请感谢enter image description here

<script>
$(document).ready(function() {
    $('#datePicker')
        .datepicker({
            format: 'mm/dd/yyyy'
        })
        .on('changeDate', function(e) {
            // Revalidate the date field
            $('#eventForm').formValidation('revalidateField', 'date');
        });

    $('#eventForm').formValidation({
        framework: 'bootstrap',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            name: {
                validators: {
                    notEmpty: {
                        message: 'The name is required'
                    }
                }
            },
            date: {
                validators: {
                    notEmpty: {
                        message: 'The date is required'
                    },
                    date: {
                        format: 'MM/DD/YYYY',
                        message: 'The date is not a valid'
                    }
                }
            }
        }
    });
});
</script>
<div class="form-group">
        <label class="col-xs-3 control-label">Date</label>
        <div class="col-xs-5 date">
            <div class="input-group input-append date" id="datePicker">
                <input type="text" class="awe-calendar" name="date" />
                <span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
        </div>
    </div>

最佳答案

在类datepicker中添加1051以上的z-index

在页面或css中添加这样的东西

<style>
  .datepicker{z-index:1151 !important;}
</style>

关于javascript - Modal 中的 Bootstrap DatePicker 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32778903/

相关文章:

javascript - Chrome未捕获范围错误: Maximum call stack size exceeded click recursion

javascript - Knockout.js 自定义绑定(bind) "Update Function is Not called "

javascript - String.indexOf 函数的意外结果?

javascript - svg 中的不透明度与填充不透明度

Swift D 日 UIPickerDate

javascript - MomentJs设计模式

javascript - 使用爬虫查找多个网站的字体系列

html - CSS - 多宽,太宽? 20000px 的宽度会导致任何网络浏览器/设备出现问题吗?

jQuery 用户界面 : Filter selectable dates on datepicker

java - 具有可拖动日期范围的日期选择器/日历 UI 组件