I have a website that uses JQuery to construct a rather large table. When I try to select a set of input elements created this way by class and add a datepicker to them, nothing happens. The table is generated durinng document.ready(); is there a certain time I have to execute $('.date_pick').datepicker(); in order for this to work? If not, what could I be doing wrong?
+2
A:
If you could provide the relevant code, it would be helpful. But basically, you should be able to assign datepicker()
to the appropriate elements once they are inserted into the DOM.
Here's a Working Demo of attaching the datepicker to inputs in a table that is inserted into the DOM through jQuery. Tested in Firefox 3.5 and IE 6.
Russ Cam
2009-09-08 22:01:05
That's insane. Thanks.
Braveyard
2009-09-08 22:34:23
A:
Without code, you'll need to debug this on your own. Couple of guidelines:
- If you're using JQuery, use JQuery's built in function rather than document.ready()
- Are you sure you're declaring the datepickers after the table is generated?
Make sure the input elements don't have the same IDs, give them the same classname, then do something like.
$('.dateInputs').datePicker();
gAMBOOKa
2009-09-08 22:38:28