JQuery =>打印所有文件名 [英] JQuery => print all files names
本文介绍了JQuery =>打印所有文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i有这个HTML代码
Hello ,
i have this html code
<input type="file" name="myfiles[]" class="required"/>
i需要提醒用户选择的文件名,所以我用这个
i need to alert file name which user choose so i use this
$("input[type='file']").change(function(){
alert($(this).val());
});
且工作正常
如果我有一个带有多个attr的文件输入,如下所示
and it works fine
what if i have a file input with multiple attr like below
<input type="file" multiple name="myfiles[]" class="required"/>
如何我可以提醒所有文件名吗?
How can i alert all files names ?
解决方案
( input [type ='file'])。change( function (){
alert(
("input[type='file']").change(function(){ alert(
(此跨度>)VAL())。
});
(this).val()); });
且工作正常
如果我有一个带有多个attr的文件输入,如下所示
and it works fine
what if i have a file input with multiple attr like below
<input type="file" multiple name="myfiles[]" class="required"/>
如何我可以提醒所有文件名吗?
How can i alert all files names ?
对于支持多文件选择的浏览器 [ ^ ],您需要使用文件
属性 [ ^ ]:
For browsers which support multiple file selection[^], you'll need to use thefiles
property[^]:
这篇关于JQuery =>打印所有文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文