I have a build a dynamic generating Formular including some input fields.
<input type='file' style="width: 70%" name="anhang[]" class="anhang" id="anhang0" multiple/>
If this input field is filled a new one is generated. The input event listener which is calling the method for generating the new field is the main problem I´m facing:
$(document.body).on("input", ".anhang", function (e) {
alert("input");
addFileInput();
});
var inputCounter = 0;
function addFileInput(){
inputCounter++;
$('#fileInput').after('<tr class="datei_anhang"><td style="width: 25%;">Anhang:</td><td><input style="width: 70%" class="anhang" id="anhang'+inputCounter+'" type="file" name="anhang[]" multiple/><input style="width: 20%; margin-left: 5px" type="button" class="entf" id="entf'+inputCounter+'" value="Entfernen"/></td></tr>').insertAfter($('.datei_anhang').last());
}
When I use a click event listener like this one it is working:
$("#anhang0").on("click", function (e) {
alert("input");
addFileInput();
});
But this solution does not bring me the behavior I want to have.
Can Someone tell me, why it works in every browser I have tested, but not in Edge? How would I have to change the Event Listener to make it work in Edge and keep the expected behavior?
I´m using Jquery 3.x. If you need any further information to help, just write it in the comments.
Thanks in advance.
Here is a fiddle for demonstration: http://jsfiddle.net/tm643v8w/7/
