jQuery Datepicker与生成的DOM元素 [英] JQuery Datepicker with generated DOM elements

查看:89
本文介绍了jQuery Datepicker与生成的DOM元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,该网站使用JQuery构造一个很大的表.当我尝试选择通过类以这种方式创建的一组输入元素并向它们添加日期选择器时,什么也没有发生.该表是在durinng document.ready();中生成的.是否有一定时间我必须执行$('.date_pick').datepicker();为了这个工作?如果没有,我该怎么办?

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?

推荐答案

如果您可以提供相关代码,将会很有帮助.但基本上,一旦将datepicker()插入到DOM中,您就应该将它们分配给适当的元素.

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.

这是 工作演示 ,将日期选择器附加到表中通过jQuery插入DOM.在Firefox 3.5和IE 6中进行了测试.

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.

这篇关于jQuery Datepicker与生成的DOM元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆