LoginSignup
2
2

More than 5 years have passed since last update.

`<input type="file">`をBootstrapのデザインに簡単に合わせる(要JQUERY)

Last updated at Posted at 2016-07-25

自分の知っているlabelを利用した方法とJqを利用したファイル名の表示をコラボしてみました

html
<label for="InputFile" class="btn btn-default">ファイル選択
<input class="hide" type="file" id="InputFile" onchange="$('#file_name').text($(this).val())"/>
</label>
<span id="file_name"></span>
<input class="btn btn-primary" type="submit" name="submit" value="送信" id="Submit">

Bootstrapのデザインクラスに対応していない <input type=file...>
スクリーンショット 2016-07-29 10.44.33.png
         ⇓
         ⇓
こんな感じでデザインを充てられますし、CSSで自由にデザインできます。
スクリーンショット 2016-07-29 10.39.50.png
スクリーンショット 2016-07-29 10.40.10.png

参照
http://qiita.com/yasumodev/items/c9f8e8f588ded6b179c9
http://qiita.com/shimayu/items/605ecac3eeec50dd4f93

2
2
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2