动态 JQuery 日期选择器代码 [英] Dynamic JQuery date picker code

查看:32
本文介绍了动态 JQuery 日期选择器代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建动态添加/删除行的动态过滤器.

I need to create dynamic filter that adds/removes rows dynamically.

它包含一个下拉框.根据选择的下拉框值,我创建了一个动态的 ,它可能有一个文本字段或下拉列表.

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.

如何为动态生成的文本字段添加日期选择器?

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'
    });

问候,蒂娜·阿格拉瓦尔

Regards, Tina Agrawal

这篇关于动态 JQuery 日期选择器代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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