Clone HTML element without cloning event

0

I have in my HTML a form that I use for "mock" that is, it only serves to be clonado to other places.

After the first cloning I change some inputs so that they use a plugin of datetimepicker but after trying to clone for a second time the input datetimepicker always refers to the previous clone.

$("#addPriceList").on('click', function () {
    $('.box-list-price-form').slideDown();

    let cloned = $('.list-price-form-mock').last().clone({
      withDataAndEvents: false,
    });

    /**
     * Adiciona o plugin de datetimepicker aos elementos clonados
     */
    $.map($(cloned).find('.datep'), function(element) {
      $(element).datetimepicker({
          format: 'DD/MM/YYYY HH:mm:ss',
          locale: 'pt-BR'
      });
    });

    $(cloned).removeClass('is-hidden').appendTo('.price-forms form');
});

That is, when I clone for the second time the second input of datetimepicker is pointing to the previous clone, I am altering the input of the previous clone instead of the current clone. How do I remove this association? I already tried withDateAndEvents: false but it did not work.

    
asked by anonymous 27.08.2018 / 20:14

0 answers