Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#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:
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);
});

Change History (1)

comment:1 Changed 12 years ago by flesler

Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.