$(function() {
$("input:file").on(this).change(function (){
$(this).parent().find('.empty_input_file').hide();
$(this).parent().find('.full_input_file').show();
});
});
答案 0 :(得分:0)
您的输入具有相同的ID和ID **必须是唯一的*
<强> jsFiddle example 强>
<div class="image-upload" title="Select image">
<label for="file-input1">
<img class="empty_input_file" src="http://goo.gl/pB9rpQ" />
<img class="full_input_file" src="http://zqapps.com/DraperDarkFlow/images/Icon-Blue.png" />
</label>
<input id="file-input1" type="file" name="d4p_attachment[]">
<br/>
</div>
<div class="image-upload" title="Select image">
<label for="file-input2">
<img class="empty_input_file" src="http://goo.gl/pB9rpQ" />
<img class="full_input_file" src="http://zqapps.com/DraperDarkFlow/images/Icon-Blue.png" />
</label>
<input id="file-input2" type="file" name="d4p_attachment[]">
<br/>
</div>