Modify ↓
Ticket #3010 (closed bug: invalid)
ui-datepicker: issue when script is included after page load
| Reported by: | kayhadrin | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | plugin | Version: | |
| Keywords: | datepicker ui body onload | Cc: | |
| Blocking: | Blocked by: |
Description
Hi there,
I'm using dynamic script includes and it seems to cause an issue with ui-datepicker (jQuery Calendar).
Basically, the error says that $.datepicker is undefined at line 1433.
Context:
- The script is included after onload/onready fired
- The initialisation of the datepicker is made at line 1432 but the definition of $.datepicker is made after at line 1437.
Problem: When the script is called after the page load (onready/onload already fired), the instruction $(document).ready(function(){...}) is run immediately but $.datepicker hasn't been declared yet.
Fix: Just switch the two instruction blocks.
Code after change:
File: ui.datepicker.js:1431
$.datepicker = new Datepicker(); // singleton instance
/* Initialise the date picker. */
$(document).ready(function() {
$(document.body).append($.datepicker._datepickerDiv)
.mousedown($.datepicker._checkExternalClick);
});
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

DatePicket belongs to jQuery UI. Please repost this to the UI Bug Tracker. Thanks.