zallarak
zallarak

Reputation: 5515

jquery - datepicker not working

I am trying out the jquery datepicker but can't get it to work. I know I must be missing something simple. Here is my code:

HTML :

<div class="demo">
    <p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->

<div class="demo-description" style="display: none; ">
    <p>The datepicker is tied to a standard form input field.  Focus on the input (click, or use the tab key) to open an interactive calendar in a sma    ll overlay.  Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as t    he input's value.</p>
</div><!-- End demo-description -->

JS :

 $(function() {
     $( "#datepicker" ).datepicker();
 });

This renders a text field, but no jquery calendar. Thank you.

Upvotes: 1

Views: 503

Answers (3)

Selvakumar Arumugam
Selvakumar Arumugam

Reputation: 79830

Date picker is in jQuery UI libs.. You need to include that for date picker to work.

Edit: You need to include this,

https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js

Add this in your html,

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" ></script>

Upvotes: 3

nithin
nithin

Reputation: 2467

Include the datapicker Javascript file

<script type="text/javascript" src="scripts/jquery.datePicker.js"></script>

jquery.datePicker.js

Upvotes: 1

Matt Healy
Matt Healy

Reputation: 18531

You haven't loaded the datepicker jquery file, just the main jquery file. Check the example given here

Upvotes: 1

Related Questions