我在模态中有此日期选择器,但无法正常工作。我已经尝试过在论坛中看到的一些代码,但是没有一个起作用。这可能是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>