0
Hello,
I’m creating a resource where the mechanism should:
- choose an image in the input
- when performing input change, a new one is created via js next
- when I get there, I need help, because the function only runs in the first input, and stops working on others... How do I get the change function to continue working on all inputs?
I put the full code in jsfiddle: https://jsfiddle.net/sb9c32qe/2/
and the section of js to be helped, I will put here tbm:
$(".dragNdropUpload_box input").change(function(){
var create_dragNdropUpload_box = "<div class='dragNdropUpload_box'>"+
"<div class='dragNdropUpload_box_input_layout'>"+
"<span class='icon far fa-plus-square'></span>"+
"<span class='text'></span>"+
"</div><!-- /dragNdropUpload_box_input_layout-->"+
"<input type='file' name='dragNdropUpload_box[]' />"+
"</div><!-- /dragNdropUpload_box-->";
$(".dragNdropUpload").append(create_dragNdropUpload_box);
//setTimeout(function(){
var getFileName = $(this).val().split('\\').pop();
alert(getFileName);
$(this).parent().find(".dragNdropUpload_box_input_layout .text").html(getFileName);
//}, 1000);
});//end change
related issues that may help you: https://answall.com/q/131216/57220 https://answall.com/q/100365/57220
– Ricardo Pontual