Working on the jquery clone with the current code if I click add more button I am able to clone in the original one i can able to attach the file but if I try to attach any file in the cloned one it is not working.
I tried even replacing id with class but still it is not working
Here is the jquery code
var count=0;
$(document).on("click", ".attch_add_button", function () {
var $clone = $('.cloned-row4:eq(0)').clone(true,true);
//$(".custom-file-input").closest('form').trigger('reset');
//$(".custom-file-input").replaceWith('.check'.val('').clone(true));
//alert("Clone number" + clone);
$clone.find('[id]').each(function(){this.id+=''});
$clone.find('.btn_more').after("<input type='button' class='btn_right btn_less1' id='buttonless'/>")
$clone.attr('id', "added"+(++count));
//$clone.find('#custom-file-input').val('');
$clone.find('.preview').hide();
$clone.wrap('<form>');
$clone.closest('form').trigger('reset');
$clone.unwrap();
//$clone.find('input[type=file]').val('');
//$clone.find('.pn_field').val("");
$(this).parents('.medica_rpt').after($clone);
});
Here is the fiddle Link
Kindly suggest here
inputis misplaced. You would have to do a deep clone by the way to copy the event listeners.clone(true, true). Apart from theinputitself being offset to the right from the button in the fiddle (seems to be in place when pasted in Codepen). I'd be very careful with any kind of file uploads by the way. codepen.io/anon/pen/RWaRzz