Datepicker not working / showing - Bootstrap 5

I am trying to add a timepicker to my page using bootstrap 5, for some reason the calendar is not loading so I can not pick any date. I do not know if I have done something wrong or the plugin is not compatible with the latest version of bootstrap.

If you click 'launch demo modal' you will see the date input field and datepicker is not working there.

enter image description here

This is the code for the input date field:

<div> <label for="date">Date</label> <div> <input type="text"> <span> <span> <i></i> </span> </span> </div>
</div> 

JS (truncated):

<script type="text/javascript"> $(document).ready(function () { $('#datepicker').datepicker(); ... });
</script> 

I also tried using $('.datepicker').datepicker(); according to the bootstrap-datepicker docs but nothing changed.

2 Answers

Demo page

Stackoverflow source

You should put bootstrap-datepicker.min.js after jquery.js. It somehow make errors because of that.

<script src=""></script>

Include below CSS and js in your file

Reference:

<!-- Bootstrap datepicker CSS -->
<link rel="stylesheet" href=""/>
<!-- Bootstrap datepicker JS-->
<script src=""></script>

For custom styling please have a look at the below link

Bootstrap Datepicker - Custom Styles

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like