$(".aFileBtn").on("change","input[type='file']",function(){
    var filePath=$(this).val();
    //filePath.indexOf("jpg")!=-1 || filePath.indexOf("png")!=-1
    if(filePath.length > 0){
        $(".fileerrorTip").html("").hide();
        var arr=filePath.split('\\');
        var fileName=arr[arr.length-1];
        $(".showFileName").html(fileName);
    }else{
        $(".showFileName").html("");
        $(".fileerrorTip").html("您未上传文件,或者您上传文件类型有误!").show();
        return false
    }
})
<a class="selfConBtn aFileBtn">选择文件<input type="file"  /></a>
        <span class="fileerrorTip"></span>
         <span class="showFileName"></span>
 <a href="#"  class="selfConBtn">点击上传</a> 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-12-14
  • 2021-07-02
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案