html - 输入类型文件在 Bootstrap 模式中不起作用

标签 html twitter-bootstrap

这非常奇怪。我有一个基本的 Bootstrap 模态,没有任何花哨的东西,并且 input type=file 在其中不起作用。当你点击它时,没有任何反应。如果文件输入移出模式并移到页面上,则没有问题。

模态代码供引用:

<div id="addImageModal" class="modal hide fade" data-toggle="modal">
<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
    x
  </button>
  <h4>Add Drawing Image</h4>
</div>
<div class="modal-body">
  <div class="form-horizontal">
    <div class="control-group">
      <label class="control-label" for="inputDisplayName">Display Name</label>
      <div class="controls">
        <input id="inputDisplayName" type="text" placeholder="">
      </div>
    </div>
    <div class="control-group">
      <div id="previewImage"></div>
    </div>
    <div class="control-group">
      <input type="file" name="files[]" multiple="">
    </div>
  </div>
</div>
<div class="modal-footer">
  <a href="#" data-dismiss="modal" class="btn">Cancel</a>
  <a href="#" class="btn btn-primary btnUploadImage">Upload</a>
</div>
</div>

真是奇怪的问题。有什么想法吗?

编辑:它是 Bootstrap 2.3.1,为了好玩,我尝试在输入上设置 z-index,但没有任何区别。

最佳答案

从容器 div 中删除 data-toggle="modal"

该属性应该只出现在用于启动模态的buttona 标签中。

关于html - 输入类型文件在 Bootstrap 模式中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16223650/

相关文章:

html - 如何更改预加载的视频 HTML5 Phaser?

javascript - 带有随机起点的 jQuery 幻灯片

javascript - Bootstrap 表悬停不起作用

javascript - 显示一个弹出窗口 隐藏其他弹出窗口

javascript 音频加载

javascript - onclick 提交上的数据库更新字段不起作用

javascript - Bootstrap datetimepicker - 基于输入值的日期

html - Bootstrap Z-index 图像不工作

html - Bootstrap CSS 堆叠文本

javascript - 本地主机上的 Google 分析 : Why is my test code not working?