I am using wbraganca dynamic form. In my form one field need date picker,so i use jui date picker like below
= $form->field($model, \"[{$i}]DOB\")-&g
Use afterDelete
and reinitialize datepicker :
$this->registerJs('
$(function () {
$(".dynamicform_wrapper").on("afterInsert", function(e, item) {
$( ".dob" ).each(function() {
$( this ).datepicker({
dateFormat : "dd/mm/yy",
yearRange : "1925:+0",
maxDate : "-1D",
changeMonth: true,
changeYear: true
});
});
});
});
$(function () {
$(".dynamicform_wrapper").on("afterDelete", function(e, item) {
$( ".dob" ).each(function() {
$( this ).removeClass("hasDatepicker").datepicker({
dateFormat : "dd/mm/yy",
yearRange : "1925:+0",
maxDate : "-1D",
changeMonth: true,
changeYear: true
});
});
});
});
');
You need to remove class hasDatepicker
to reinitialize datepicker.