在谷歌 Chrome 浏览器中,我尝试了几种方法 + 以下方法,但没有一个给我附加文件名的值,验证后我将提交文件。但总是找不到它的未定义或 val() ..
如何解决?
console.log($("input[name='attachment[]']"));
/* Output:
[
<input type="file" name="attachment[]" id="attachment">
,
<input type="file" name="attachment[]" id="attachment">
,
<input type="file" name="attachment[]" id="attachment">
]
*/
$.each($("input[name='attachment[]']"), function(i,v) {
console.log(i);
console.log(v); //v.val() does not exist... even uploaded a file and showing file
});
/* Output:
0
<input type="file" name="attachment[]" id="attachment">
1
<input type="file" name="attachment[]" id="attachment">
2
<input type="file" name="attachment[]" id="attachment">
*/
return false;