'Bootstrap Filestyle - Changing button text for file field doesn't work
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');
File field
$("#changeAccountsSourceModal .form-horizontal").replaceWith("<input type=\"file\" class=\"filestyle\" data-input=\"true\" data-buttonText=\"Choose address\">");
$("#changeAccountsSourceModal :file").filestyle();
Solution 1:[1]
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"
});
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tyler2P |
