psychok7
psychok7

Reputation: 5473

twitter bootstrap date picker not working

I have been extensively searching for the answer but i cant seem to find one that works. I am using Django 1.4, with twitter boostrap 2.0.4 and i am trying to use date picker (eyecon) with no success. When i click on the input box no date box shows up.

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

At the end of my base.html i have (right before closing the body):

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

Finally on me jquery.script.js i have:

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

Upvotes: 2

Views: 4356

Answers (2)

Jonas Geiregat
Jonas Geiregat

Reputation: 5432

You have selected all elements who have the class "datepicker", while your input element definition does not have such a class but rather has datepicker as id attribute set.

Either select the id field $("#datepicker") or add a class ".datepicker" to your input field.

Upvotes: 4

Tanmay
Tanmay

Reputation: 746

Do this: $(document).ready(function(){ $('#datepicker').datepicker()});

As you have set id="datepicker"

'.' is used for class and '#' is used for id

Upvotes: 0

Related Questions