Skip to main content

Bug Tracker

Side navigation

#3010 closed bug (invalid)

Opened June 09, 2008 07:18PM UTC

Closed June 10, 2008 07:59PM UTC

Last modified March 14, 2012 10:05PM UTC

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:
Blocked by: Blocking:
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);
});
Attachments (0)
Change History (1)

Changed June 10, 2008 07:59PM UTC by flesler comment:1

resolution: → invalid
status: newclosed

DatePicket belongs to jQuery UI.

Please repost this to the UI Bug Tracker.

Thanks.