How to remove the uploaded image in any box?

前端 未结 4 802
孤城傲影
孤城傲影 2021-01-27 09:42

My code is very long. I can not show you all here. I just show the javascript code only

My javascript like this :



        
4条回答
  •  Happy的楠姐
    2021-01-27 10:26

    Sorry, I was misunderstand.

    Mayby you need a judgement after you delete an image that make sure the next image is not show.

    $('#thumbnail-view-delete-'+i).click(function(){
      $('input[name="photo-'+i+'"]').val('');
        document.getElementById("thumbnail-view-li-"+i).style.display = "none";
        document.getElementById("thumbnail-upload-li-"+i).style.display = "";
        if(document.getElementById("thumbnail-view-li-"+(i+1)).style.display === "none"){
          document.getElementById("thumbnail-upload-li-"+(i+1)).style.display = "none";
          document.getElementById("thumbnail-slot-li-"+(i+1)).style.display = "";
        }
    });

    This can descrease the messy.

提交回复
热议问题