在提交类和刷新页面时删除类

时间:2017-12-22 02:42:36

标签: javascript jquery css3 button submit



<div class="col-sm-6">
  <div class="bc-uploader" onclick="$('#frontId').click()">
    <div class="bc-upload-text">
      <span>
        Drag and drop a file or select an image
      </span>
    </div>
    
    <div class="bc-image-text">
      <span>
        Change current image
      </span>
    </div>
    
    <div class="bc-img-wrapper">  
      <img class="file-upload-image" id="frontId-img" src="/images/investor/35403/frontId.jpg" alt="">
    </div>  
    
    <input type="file" name="frontId" id="frontId" accept="image/*">
  </div>
</div>


--- Submit Buttom ---

<button id="btn-kyc-verification" type="submit" class="bc-btn bc-btn-blue">Submit</button>
&#13;
&#13;
&#13;

当我上传图片并点击提交按钮时,页面刷新并显示&#34;拖放文件或选择和图像&#34;覆盖图像。当我按提交和页面刷新时,该文本应该消失。任何方式当我点击提交按钮,页面刷新和类&#34; bc-upload-text&#34;删除或隐藏?

1 个答案:

答案 0 :(得分:0)

JavaScript方式

var text = document.querySelector(".bc-upload-text");
var btn = document.getElementById("btn-kyc-verification");

btn.addEventListener("click", function(){
   text.remove();
});

jQuery方式

var text = $(".bc-upload-text");
var btn = $("#btn-kyc-verification");

btn.on("click", function(){
   text.remove();
});