zazvorniki
zazvorniki

Reputation: 3602

Bootstrap Datepicker not showing calendar

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/

Upvotes: 0

Views: 10171

Answers (5)

user3225497
user3225497

Reputation: 39

Run when all page loaded:

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

Upvotes: 0

user3429000
user3429000

Reputation: 11

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

Upvotes: 1

BENARD Patrick
BENARD Patrick

Reputation: 30975

Just alternate

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

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

Upvotes: 3

user3429000
user3429000

Reputation: 11

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' />

Upvotes: 0

DonJuwe
DonJuwe

Reputation: 4563

Try

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

since your input has this class.

Upvotes: 0

Related Questions