【问题标题】:Input element with file type does not work in chrome - Angular 2具有文件类型的输入元素在 chrome 中不起作用 - Angular 2
【发布时间】:2016-10-28 03:23:21
【问题描述】:

我正在开发一个 Angular 2 应用程序。请参阅下面的部分模板 -

     <label class="import-label" title="Select file">
          <span class="grid-btn fa fa-folder">
             <input type="file" class="form-control import-input-file" id="contactname" aria-describedby="contactname" 
              placeholder="File Name" name="filename" style="display:none;"
             (change)="onChange($event)">
           </span>
    </label>

截图 -

当我单击文件夹图标按钮时,选择文件的对话框不会在 Chrome 中打开(它适用于 IE,如预期的那样)。但是,它可以在 Chrome 中双击。

注意

input tagdisplay:none

【问题讨论】:

    标签: html css angular


    【解决方案1】:

    for="contactname" 添加到标签

    <label class="import-label" title="Select file" for="contactname">
    

    【讨论】:

    • 感谢@domfx。它仍然不适用于“for”属性。虽然我找到了其他解决方案。设置 display:none 是问题。我现在使用了 opacity:0;现在可以了!
    猜你喜欢
    • 2018-08-15
    • 1970-01-01
    • 2017-03-19
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 1970-01-01
    • 2014-04-14
    • 1970-01-01
    相关资源
    最近更新 更多