$(document).on("change","[id*='UploadsInput_']",function(){
       var item=$(this).closest(".PicItem");
       var form='#UploadsForm_'+$(this).attr('id').split('_')[1];
       $(form).ajaxSubmit({
           url:'plus/up_pic_ajax.php',
           dataType: 'json',
           beforeSend: function() {
           },
           uploadProgress: function(e,p,t,c) {
           },
           success:function(data){
               if (data.status==1) {
                   var src="/uploads/files/"+data.pic;
                   $(item).find('.Pic').attr("src",src);
                   $(item).find('.Pic').removeClass('am-hide');
               }else{
               layer.msg(data.msg, {icon: 2}); //显示错误信息
               }
           },
           error:function(xhr){
               console.log(xhr.responseText);
           }
       });
   });


两种方法

[1]

input所属的form表单reset()

$("Form_op")[0].reset();


[2]设置input file value 值为空

item.val("");

暂无留言,赶快评论吧

欢迎留言