LoginSignup
0
0

More than 1 year has passed since last update.

MDB5でformのinputでborderが出ない時の対処

Posted at

概要

MDB5でformのinputでborderが出ない時にborderを出す備忘録

対象

MDB公式(Material Design for Bootstrap v5)
https://mdbootstrap.com/

問題

公式サイトの通りにInputフィールドを下記だけ入れるとinputのborderが消える

<div class="form-outline">
  <input type="text" id="form12" class="form-control" />
  <label class="form-label" for="form12">Example label</label>
</div>

期待するもの↓
スクリーンショット 2022-09-05 20.53.17.png

実際になるもの↓
スクリーンショット 2022-09-05 20.52.27.png

対応

実は公式のInputの一番下に書いてあった
動的要素やサイズ変更があれば、下記スクリプトを実行する

document.querySelectorAll('.form-outline').forEach((formOutline) => {
  new mdb.Input(formOutline).update();
});

参照:
https://mdbootstrap.com/docs/standard/forms/input-fields/#section-dynamic-input-initialization

0
0
0

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
0
0