Jquery UI Datepicker在克隆元素后不起作用 [英] Jquery UI Datepicker don't work after clone element

查看:368
本文介绍了Jquery UI Datepicker在克隆元素后不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个克隆元素的问题,jQuery UI DatePicker在克隆元素后不起作用。链接到示例: http://jsfiddle.net/V25qA/1/

I have a problem with cloning an element, the jQuery UI DatePicker does't work after cloning the element. Link to example: http://jsfiddle.net/V25qA/1/.

推荐答案

您不能(安全地)克隆jQuery小部件 - 它们有可能无法复制的状态。

You can't (safely) clone jQuery widgets - they have state that may not get copied.

在克隆之前,您应该在旧元素上调用 .datepicker('destroy'),然后调用 .datepicker()再次对克隆的输入元素进行重新初始化。

You should call .datepicker('destroy') on the old element before you clone it, and then call .datepicker() again on the cloned input element to reinitialise it.

这篇关于Jquery UI Datepicker在克隆元素后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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