I wrote the code to create an tag when I click the Add Attachment button.
And, I have the following code.
<input type="file" name="fileup['+idx+']" id="fileup['+idx+']">
<input class="btn btn-default btn-sm" type="button" value="fileSizeCheck" onclick="fileSizeCheck('+idx+')" />
function fileSizeCheck(idx)
{
$('input[id="fileup['+idx+']"]').change(function()
{
var getName = $(this).val();
console.log(getName);
});
}
idx is a unique number that is generated each time a row is added, and it is an automatically incrementing value.
When I run the above code, I get the following result:
<input type="file" name="fileup[1]" id="fileup[1]">
<input type="file" name="fileup[2]" id="fileup[2]">
<input type="file" name="fileup[3]" id="fileup[3]">
<input type="file" name="fileup[4]" id="fileup[4]">
However, the contents of the script are not executed. There is no indication in the alert window, nor is there confirmation from console.log.
That does not mean that page faults occur.
Did I make the grammar wrong?
I just want to get the filename when I select the file.
How do I write to implement what I want to implement?