2

Bootstrap 2.3.2 の Bootstrap Filestyle プラグインのファイル フィールドのボタン テキストを変更したいのですが、機能せず、ボタンのテキストはデフォルトのままです。jqueryで要素を置き換えてファイルフィールドを作成し、属性data-buttonTextまたはメソッドでテキストを設定しようとしました$("#changeAccountsSourceModal :file").filestyle('buttonText', 'Choose address');

jsfiddle サンプル

ファイル フィールド

$("#changeAccountsSourceModal .form-horizontal").replaceWith("<input type=\"file\" class=\"filestyle\" data-input=\"true\" data-buttonText=\"Choose address\">");

$("#changeAccountsSourceModal :file").filestyle();
4

1 に答える 1

5

ファイルスタイルの開始時にオブジェクトにオプションを渡して試してみたところ、うまくいきました。

$("#changeAccountsSourceModal :file").filestyle({buttonText: 'Choose address'});

皮肉なことに、値のあとがきを変更しようとすると、テキストがボタンに追加されるだけです。

$("#changeAccountsSourceModal :file").filestyle('buttonText', 'Choose address');

フィドル

ワーキングフィドル

于 2014-11-08T13:24:38.450 に答える