views:

42

answers:

1

This is on the one that pops up when you click the linked input element. I want to be able to insert some static text underneath the table of dates that will appear and stay even if the user scrolls to different months.

I managed to sort of getting working by, with jQuery, using

$('.ui-datepicker').after('text');

on the .ui-datepicker class. The problem with that was, it didn't work when the user scrolled to the next month. I managed to fix that as well, by constantly clearing and re-adding the text with setTimeout. That was really hacky, but worked.

The next problem came when I had multiple calendars on the page, each with different texts. I tried targeting specific instances on .ui-datepicker with the above method, but I discovered there is actually only one instance of the datepicker that is shared between all calendar fields on the page.

So is it actually possible?

A: 

You need create a variable to hold the instance of the datepicker. So When you create it, do this:

var myDatePicker = $("#myDatePickerElement").datepicker();
myDatePicker.after("text");
Zacho
But I don't create it, jquery ui does, behind the scenes. And even when you have multiple ones on the page, they all use the same instance.
Gnuffo1
When you use the variable to cache the current instance of a jQuery UI element, you are accessing ONLY that element. So by selecting myDatePicker, you are only accessing that instance.
Zacho