Bug Tracker

Modify

Ticket #3010 (closed bug: invalid)

Opened 5 years ago

Last modified 14 months ago

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

comment:1 Changed 5 years ago by flesler

  • Status changed from new to closed
  • Resolution set to invalid

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.