Bootstrap Datepicker not showing calendar

10.1k views Asked by At

I've been trying to get bootstraps date picker working for a little while now and it seems I'm doing something wrong. Any help would be appreciated.

I have the bootstrap.datepicker.js in the correct folder and am calling the class like so in my main js.

  $('.datepicker').datepicker();​

and my input looks like this

<input type='text' class='form-control date-picker datepicker dates col-md-3' name="" value="" data-date-format='mm/dd/yyyy' />

What am I missing?

To help show what is happening, I've created a jsfiddle http://jsfiddle.net/75JgV/2/

5

There are 5 answers

1
DonJuwe On

Try

$('.date-picker').datepicker();​

since your input has this class.

1
user3429000 On

your input should have class the same as you defined in JS

so it should look like this

<input type='text' class='datepicker form-control date-picker dates col-md-3' name="" value="" data-date-format='mm/dd/yyyy' />

0
BENARD Patrick On

Just alternate

Your $('.datepicker').datepicker(); has to be after the JS component

fiddle : http://jsfiddle.net/75JgV/3/

0
user3429000 On

The problem with your jsfiddle example is that the

$('.datepicker').datepicker();​

code has to go after you include the jquery, so put it in the end of your js

0
user3225497 On

Run when all page loaded:

$(function(){
 $('.datepicker').datepicker();​
});