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?Answer1:
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 <strong><a href="http://jsbin.com/ojoye" rel="nofollow">Working Demo</a></strong> 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.Answer2:
Without code, you'll need to debug this on your own. Couple of guidelines:<ul><li>If you're using JQuery, use JQuery's built in function rather than document.ready()</li> <li>Are you sure you're declaring the datepickers <strong>after</strong> the table is generated?</li> <li>
Make sure the input elements don't have the same IDs, give them the same classname, then do something like.