From 44bad51a573d61e7706077a23ae71bd9cab813fe Mon Sep 17 00:00:00 2001 From: Xianglong Wu Date: Thu, 29 Mar 2018 15:47:14 +0800 Subject: [PATCH] Update file.html --- qiniu_fields/templates/file.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qiniu_fields/templates/file.html b/qiniu_fields/templates/file.html index 310512a..5f9c8b4 100644 --- a/qiniu_fields/templates/file.html +++ b/qiniu_fields/templates/file.html @@ -5,7 +5,7 @@ 选择文件 {% if not widget.required %} - + {% endif %}

@@ -38,10 +38,11 @@ } } }; - var removeImage = function () { - $('#{{ widget.name }}-container a').attr('href', ''); - $('#{{ widget.name }}-container img').attr('src', '/static/img/img_default.png').css('display', 'inline-block'); - $('#id-{{ widget.name }}').val(''); + var removeImage = function (e) { + var container = $(e).parent().parent(); + container.find('p.url a').attr('href', ''); + container.find('p.url img').attr('src', '/static/img/img_default.png').css('display', 'inline-block'); + container.find('input').val(''); }; addLoadEvent(function () {