【问题标题】:I can't edit my <input type="file"> tag [duplicate]我无法编辑我的 <input type="file"> 标签 [重复]
【发布时间】:2014-10-27 03:27:43
【问题描述】:

我无法编辑此按钮,我尝试使用 bootstrap javascript。这是我的代码示例。任何帮助将不胜感激

<html>
    <head>
        <script type="text/javascript" src="assets/js/bootstrap-filestyle.js"> </script>
        <script>
            $(":file").filestyle({input: false});
        </script>
    </head>
    <body>
        <input type="file" class="filestyle" data-input="false">
    </body>
</html>

【问题讨论】:

  • 只需将 input[type=file] 清除或隐藏,并使用 组合来触发对文件输入的点击同时接受按钮上的 CSS 样式。

标签: javascript twitter-bootstrap


【解决方案1】:

简短的回答:你不能。文本由浏览器预定义。

解决方法可能是使用图片或第三方文件上传器。
查看此相关答案:How to change the button text of <input type="file" />?

【讨论】:

    【解决方案2】:

    我认为您正在尝试将文本“选择文件”替换为其他内容;

    如果是这种情况,请尝试以下语句。

    抱歉,信誉不足,无法发表评论。

    <input type='file' style='opacity: 0; width:90px; position: absolute; z-index:2'>
    <button class='btn-margin btn grey' style='z-index: 1;width:90px;cursor:pointer;'>Browse</button>";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-26
      • 2011-05-16
      • 1970-01-01
      • 2011-05-30
      • 2019-01-27
      • 2013-05-05
      • 1970-01-01
      • 2023-03-20
      相关资源
      最近更新 更多