動態輸入文件中的字段都被選擇的文件名我也可以更通過點擊添加動態輸入型文件中的字段添加更多使用jQuery/JavaScript的
我已經腳本時選擇它來獲取文件名,但它只爲第一個領域而不是其他領域。
那麼如何在選擇時獲取所有文件名?
$("#em_add").click(function(){
\t \t \t var decoration_box = $(".one").html();
\t \t \t $(".logos").append('<div class="one">'+decoration_box+'</div>');
});
$('.logo').change(function() {
\t var filePath=$(this).val();
\t alert(filePath);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="em_add">Add New</button>
<div class="logos">
<div class="one">
<input type="file" name="logo[]" id="logo" class="logo" />
</div>
</div>