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