动态的JQuery日期选择器代码 [英] Dynamic JQuery date picker code
问题描述
我需要创建动态过滤器来动态添加/删除行。
I need to create dynamic filter that adds/removes rows dynamically.
它包含一个下拉框。根据所选的下拉框值,我创建一个动态< TD>
,可能有一个文本字段或下拉列表。
It contains a drop-down box. Depending upon the drop-down box value selected, I create a dynamic <TD>
that may have a text field or drop-down list.
如果它是一个文本字段,那么我必须为该文本字段添加日期选择器。
If it's a text field, then I have to add date picker for that text field.
我已经做到了,除了日期选择器动态生成的文本字段。
如果您正在创建100行,则文本字段的名称对于所有行都应该相同。
I have done this, except date picker for dynamically generated text field.
If you're creating 100 rows, the text fields' names should be same for all rows.
如何添加datepicker for dynamic generated text field?
How to add datepicker for dynamically generated text field?
推荐答案
我有同样的问题。
您需要将DatePicker重新绑定到动态添加的行。
日期选择器将hadDatePicker类与动态行相关联。
I had the same issue. You would need to rebind the DatePicker to the dynamically added row. The date picker associates a hadDatePicker Class to the dynamic row.
所以你需要删除它并重新绑定。
So you would need to remove that and rebind.
这样的东西 -
jQuery('.date-pick').removeClass('hasDatepicker').datepicker({
dateFormat: 'mm-dd-yy'
});
问候,
Tina Agrawal
Regards, Tina Agrawal
这篇关于动态的JQuery日期选择器代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!