admin管理员组文章数量:1418070
I would like to change button text for file field in Bootstrap Filestyle plugin in Bootstrap 2.3.2, but it doesn't work and text of button is still default. I create file field by replacing element in jquery and tried to set text by attribute data-buttonText
or method $("#changeAccountsSourceModal :file").filestyle('buttonText', 'Choose address');
jsfiddle sample
File field
$("#changeAccountsSourceModal .form-horizontal").replaceWith("<input type=\"file\" class=\"filestyle\" data-input=\"true\" data-buttonText=\"Choose address\">");
$("#changeAccountsSourceModal :file").filestyle();
I would like to change button text for file field in Bootstrap Filestyle plugin in Bootstrap 2.3.2, but it doesn't work and text of button is still default. I create file field by replacing element in jquery and tried to set text by attribute data-buttonText
or method $("#changeAccountsSourceModal :file").filestyle('buttonText', 'Choose address');
jsfiddle sample
File field
$("#changeAccountsSourceModal .form-horizontal").replaceWith("<input type=\"file\" class=\"filestyle\" data-input=\"true\" data-buttonText=\"Choose address\">");
$("#changeAccountsSourceModal :file").filestyle();
Share
Improve this question
asked Nov 8, 2014 at 13:13
MattMatt
8,99235 gold badges133 silver badges242 bronze badges
2 Answers
Reset to default 5Just tried it out by passing the option in an object on initiating filestyle, works.
$("#changeAccountsSourceModal :file").filestyle({buttonText: 'Choose address'});
Ironically when you try to change the vaule afterwords the text just gets added to the button.
$("#changeAccountsSourceModal :file").filestyle('buttonText', 'Choose address');
fiddle
working fiddle
You can change button text, remove icon, placeholder and more
$(document).ready(function () {
$("#myInputId").fileinput({
mainClass: "input-group-md",
showUpload: false,
previewFileType: "image",
browseClass: "btn btn-sucess",
browseLabel: "Select Photo",
browseIcon: "<i class=\"icon-picture\"></i> ",
removeClass: "btn btn-danger",
removeLabel: "Delete",
removeIcon: "<i class=\"icon-trash\"></i> ",
uploadClass: "btn btn-info",
uploadLabel: "Upload",
uploadIcon: "<i class=\"icon-upload\"></i> ",
msgPlaceholder: "Select Photo"
});
});
本文标签: javascriptBootstrap FilestyleChanging button text for file field doesn39t workStack Overflow
版权声明:本文标题:javascript - Bootstrap Filestyle - Changing button text for file field doesn't work - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745281974a2651473.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论