zoukankan      html  css  js  c++  java
  • 通过label点击触发隐藏input:file上传文件或者图片


    label的属性for就是要触发的Input id

    <label for="file" class="img1">
       <div id="fileList1" class="fileLists">
           <img src="/template/mobile/new2/static/images/aodi/idA.png" alt="">
       </div>
         <input type="file" accept="image/*" name="" id="file" class="file" onclick="handl(1)">
    </label>
    
    .file {
        display: none;
    }


    点击label就等于点击到input,这是label的一个bug

  • 相关阅读:
    @atcoder
    @loj
    @AGC037
    @uoj
    @uoj
    @loj
    @loj
    @loj
    @loj
    @loj
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15453061.html
Copyright © 2011-2022 走看看