如何更改<input type="file"的按钮文本/>? [英] How to change the button text of &lt;input type=&quot;file&quot; /&gt;?

查看:27
本文介绍了如何更改<input type="file"的按钮文本/>?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<input type="file" value="Browse" name="avatar" id="id_avatar" />

我试图修改 value,但它不起作用.如何自定义按钮文字?

I tried to modify the value, but it's not working. How to customize the button text?

推荐答案

使用 Bootstrap FileStyle,用于设置表单文件字段的样式.它是一个名为 Twitter Bootstrap 的基于 jQuery 的组件库的插件

Use Bootstrap FileStyle, which is used to style the file fields of forms. It is a plugin for a jQuery-based component library called Twitter Bootstrap

示例用法:

包括:

<script type="text/javascript" src="js/bootstrap-filestyle.min.js"> </script>

通过 JavaScript:

Via JavaScript:

$(":file").filestyle();

通过数据属性:

<input type="file" class="filestyle" data-classButton="btn btn-primary" data-input="false" data-classIcon="icon-plus" data-buttonText="Your label here.">

这篇关于如何更改<input type="file"的按钮文本/>?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆