我在一次上传了多张图片后,想要给每张图片的右上角设置一个可以点击删除的图标,请问怎样实现?
js代码:
onUploadSuccess: function(file, data, response) {
var proPath = $("#proImg").val();
$("#proImg").val(data+";"+proPath);
$("#path").val(data);
$("#filepath").append("<img src=/stream?def=LOGO/default-pic.jpg&rel="+data+"/>");
parent.showTipCom("#success","图片上传成功!",1000,"","");
}
HTML代码
<td style="width:15%;height:80px;"><span>上传图片:</span></td>
<td>
<input type="hidden" id="proImg" name="proImg" value="${productInfo.proImg}">
<div id="proUploaddiv" style="height: 30px;width: 80px;float: left;margin-left: 5px;margin-top: 10px;" >
<input type="file" name="proImgs" id="proImgs" style="margin-top: 5px;width: 80px;height: 30px;line-height: 30px;text-align: center;color: #FFF;border: 0px ;display: block;font-size: 14px;cursor: pointer; background: url(/res4.0/image/upload.png) no-repeat center top;margin-right:-25px;"/>
</div>
</td>
在上传的时候 $("#filepath").append("");的后面加上$("#filepath:last-child").append("
$(".你那个图标class").on("click",function(){
$(this).parents("#filepath").remove();
})