javascript - How to remove the "no file selected" flag for input type=file?
高洛峰
高洛峰 2017-05-16 13:32:37
0
5
1982

<input type="file"> I want to remove the words "No file selected" at the end. How to do this?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(5)
黄舟

They are all answers that are not what the question was asked

<style>
input[type="file"] {
  color: transparent;
}
</style>
<input type="file">
Peter_Zhu

The default style is too ugly. We can set the default input element transparency to 0 and then cover it with a custom element.
http://codepen.io/zengkan0703...

滿天的星座
<label class="button">
  <span>选择文件</span>
  <input type="file" style="display: none" onchange="处理函数">
</label>
.button {
  /* 自定义按钮样式 */
}
阿神

<label for="inputFile" class="button">
<span>Select file</span>
</label>
<input type="file" id="inputFile" style= "display: none" onchange="changed">

Customize the label style yourself; when you click the label, you click the corresponding input,

某草草

Upload the code directly, you can refer to it.

//css
.imgboxa{
          position: absolute;
          color:#999;
          left: 50%;
          top: 50%;
          transform: translate3d(-50%,-50%,0);
          -moz-transform: translate3d(-50%,-50%,0);
          -ms-transform: translate3d(-50%,-50%,0);
          -webkit-transform: translate3d(-50%,-50%,0);
          -o-transform: translate3d(-50%,-50%,0);
        }
//html
<p class="imgBox1" data-value='' style='position:relative;width:100%;text-align:center'>
        <img class="addcarimg1 img-responsive" id="blah1" src="" style="width:100%;height:20rem;overflow:hidden;"/>
        <a href="javascript:;" class="imgboxa">
         <span class="iconadd jiaNo1">+</span></br>
         <span class="txt textNo1">身份证正面</span>
         <input style='position: absolute; left: 0px; top: 0px; height: 100%; width: 100%; opacity: 0;' type='file' class="imgInp imgInp1" id="imgInp" data-value='1' />
        </a>
    </p>  
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template