如何更改< input type ="文件"的文本" /> ;? [英] How to change the button text of <input type="file" />?
本文介绍了如何更改< input type ="文件"的文本" /> ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< input type =filevalue =Browsename =avatarid =id_avatar/>
我尝试修改值
,但它不工作。如何自定义按钮文字?
示例用法:
头文件:
< script type =text / javascriptsrc =js / bootstrap-filestyle.min.js> < /脚本>
通过JavaScript:
$( :文件)filestyle();
通过数据属性:
< input type =fileclass =filestyledata-classButton =btn btn-primarydata-input =falsedata-classIcon =icon-plusdata-buttonText = 你的标签在这里。>
<input type="file" value="Browse" name="avatar" id="id_avatar" />
I tried to modify the value
, but it's not working. How to customize the button text?
解决方案
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
Sample usage:
Include:
<script type="text/javascript" src="js/bootstrap-filestyle.min.js"> </script>
Via JavaScript:
$(":file").filestyle();
Via data attributes:
<input type="file" class="filestyle" data-classButton="btn btn-primary" data-input="false" data-classIcon="icon-plus" data-buttonText="Your label here.">
这篇关于如何更改< input type ="文件"的文本" /> ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文