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

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

问题描述

 < input type =filevalue =Browsename =avatarid =id_avatar/> 

我尝试修改,但它不工作。如何自定义按钮文字?

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



示例用法:



头文件:

 < 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.">

这篇关于如何更改&lt; input type =&quot;文件&quot;的文本&quot; /&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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