How can I use jquery to count the length of the files from the multiple-input field?
alert($('#myForm input[type=file]').files.length);
<input type="file" multiple="multiple" name="file[]"/>
error:
$("#myForm input[type=file]").files is undefined
It works find with plain js but I don't want to use ID in my input field.
alert(document.getElementById('file').files.length);
<input type="file" multiple="multiple" name="file[]" id="file"/>