且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何克隆jQuery Datepicker输入字段

更新时间:2023-10-17 18:49:16

尝试这个

var $clone=$(".datepicker").clone();
$clone.datepicker("destroy");
$clone.removeAttr("id");
$clone.datepicker();
$('form').append($clone);

当您复制一行时,它会复制每件事物
以及何时添加日期选择器再次通过ID调用输入,您必须删除该ID,以便下一个日期戳可以为输入分配一个新的id:)

when you clone a row it copies every thing, and when the date picker is added again it calls the input by id, you must remove the id so that the next datepicker can assign a new id to the input :)