Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating to latest JQuery UI and datepicker is causing the datepicker to always be seen

We have just updated to JQuery 1.5.2.min and JQuery-ui-1.8.11.min and are using the latest datepicker.js files as well (I say files because we are using some of the localized versions of the datepicker also).

Before we updated we used the following code to initialize and use the datepicker and set the locale

$.datepicker.setDefaults($.datepicker.regional['']);

$('.datepicker').keypress(function()
{
    $(this).datepicker('hide');
});

$('.datepicker').datepicker();
$('.datepicker').datepicker('option', $.datepicker.regional[widgetCulture]);
$('.datepicker').datepicker('option', 'showAnim', '');
$('.datepicker').datepicker('setDate', new Date());

Since the update, when you scroll to the bottom of the screen where the datepicker is used, you can see it below all the controls. Its just floating there! Once you click on a field that the datepicker is associated with, it appears where it should and then does not appear at the bottom of the screen again until you refresh the page. When I comment out everything but the .datepicker() line all I see is a grey bar instead of the entire calendar which is a tad better, I suppose (not really), but still needs to be fixed. Any other line of the above code makes the entire calendar appear. This is severely frustrating!

Can someone please shed some light on this?

like image 624
The Sheek Geek Avatar asked Apr 20 '11 19:04

The Sheek Geek


People also ask

How do I make my datepicker always visible?

Simply call . datepicker() on a div instead of an input. (To display the datepicker embedded in the page instead of in an overlay.) Save this answer.

How can change date format in jQuery ui datepicker?

inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });

What is UI datepicker?

A control for inputting date and time values.


1 Answers

I've had this same bug for a while and just got around to looking at it tonight. I'm not sure why this bug occurs, but the following is what I've done to eliminate the visual artifact on the screen. Right after you create your datepicker(s), execute the following:

$('#ui-datepicker-div').css('display','none');

Caveat: When I look at the dom generated by Safari and step through the code that creates the datepicker, the code above appears to do nothing to the dom, but it does hide the visual affect on the screen.

like image 54
sjk Avatar answered Nov 08 '22 03:11

sjk