I have this datepicker inside a modal but not working. I already tried some of the codes i saw in the forum, but none of them is working. Could this be a javascript problem? I am not sure what making it not to show the datepicker,anyone who can help me please thanks
<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>
add z-index above 1051 in class datepicker
add something like this in page or css
<style>
.datepicker{z-index:1151 !important;}
</style>
The same issue i faced, the best method is please check the below code which i used to fix this issue. This will work wen you click any where in the body
Please add the just above of
div model-body
<script>
$(document).on("click", ".modal-body", function () {
$("#datepicker").datepicker({
dateFormat: 'yy-mm-dd'
});
});
</script>
<div class="modal-body">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With