diff --git a/static/admin.js b/static/admin.js index 97900b3df..2f9b82cec 100644 --- a/static/admin.js +++ b/static/admin.js @@ -479,8 +479,8 @@ $(function () { var name = $(this).attr('name') || 'image'; var type = $(this).data('type') || 'png,jpg'; var $tpl = $(''); - $(this).hide().attr('name', name).after($tpl).on('change', function () { - $tpl.get(0).style = this.value ? 'background-image:url(' + this.value + ')' : ''; + $(this).attr('name', name).after($tpl).on('change', function () { + !!this.value && $tpl.css('backgroundImage', 'url(' + this.value + ')'); }).trigger('change'); }; @@ -489,7 +489,7 @@ $(function () { var type = $(this).data('type') || 'png,jpg'; var name = $(this).attr('name') || 'umt-image'; var $tpl = $(''); - $(this).hide().attr('name', name).after($tpl).on('change', function () { + $(this).attr('name', name).after($tpl).on('change', function () { var input = this, values = [], srcs = this.value.split('|'); $(this).prevAll('.uploadimage').map(function () { values.push($(this).attr('data-tips-image'));