Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap datepicker not working at all

I've been trying to get bootstrap datepicker from here: https://github.com/eternicode/bootstrap-datepicker to work but the calender won't show up at all. Not sure what I'm missing? I've linked everything correctly. Any help would be great, thanks!

<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/datepicker.css" rel="stylesheet">

<input type="text" value="02/16/12" data-date-format="mm/dd/yy" class="datepicker" >

<script src="js/bootstrap.js"></script>
<script src="js/jquery-1.7.1.js"></script>  
<script src="js/bootstrap-datepicker.js"></script>

<script type="text/javascript">
$('.datepicker').datepicker();
</script>   

like image 976
Soulipsyz Avatar asked Mar 20 '13 23:03

Soulipsyz


2 Answers

$(document).ready(function() {
    $('.datepicker').datepicker();
})

It works on here I used jQuery 1.7.2, Bootstrap 2.0.2 and the latest datepicker JS. CSS is missing in my test, but the datepicker occurs on click! :-)

like image 129
powtac Avatar answered Sep 22 '22 13:09

powtac


You need to load jquery before you load bootstrap.js, in addition to adding the $(document).ready().

<script src="js/jquery-1.7.1.js"></script>  
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-datepicker.js"></script>

Hope that helps.

like image 40
Todd Avatar answered Sep 21 '22 13:09

Todd