<input type="file" value="Browse" name="avatar" id="id_avatar" />
我试图修改 value
,但它不起作用。如何自定义按钮文字?
最佳答案
使用 Bootstrap FileStyle ,用于对表单的文件字段进行样式设置。它是一个名为 Twitter Bootstrap 的基于 jQuery 的组件库的插件
示例用法:
包括:
<script type="text/javascript" src="js/bootstrap-filestyle.min.js"> </script>
通过 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.">
关于html - 如何更改<input type ="file"/>的按钮文字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1944267/