javascript - jQuery - Dynamic inputs are not appending into form submit -
i trying create button "add field" add file type inputs dynamically defined below:
$("#addnew").click(function(e) { e.preventdefault(); $(".gallery-container").append('<div class="col-md-3"><div id="image-preview-'+id+'" class="image-preview"><label id="image-label-'+id+'" for="image-upload-'+id+'" class="image-label">wybierz plik</label><input type="file" id="image-upload-'+id+'" name="gallery[]" accept="image/*" class="image-upload" /></div><button type="button" class="removeimage btn btn-danger btn-sm btn-block">usuĊ plik</button></div>'); id++; });
it's adding input fields correctly , each input have file when tried submit form (no ajax, standard), these fields not submitted.
when set "append" hardcoded in code, i.e. next "add field" button, fine, problem when dynamically added.
where problem?
Comments
Post a Comment