14
12

More than 1 year has passed since last update.

Rails - 処理中アニメーション付ボタン(コード1行)

Last updated at Posted at 2015-08-12

やりたいこと

クリック後にボタンを無効化し、こんな感じで処理中のアニメーションをボタンに表示したい。

| 検索中|
|:---:|

環境

  • Rails 4.2.1
  • jQuery UJS
  • FontAwesome

RailsでHAML

= f.button "検索", data: { disable_with: "<i class='fa fa-spinner fa-spin'></i>検索中" }

HTML

<button name="button" type="submit" class="submit"
  data-disable-with="<i class='fa fa-spinner fa-spin'></i> 検索中">
  検索
</button>

参考資料

14
12
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
14
12