/ Forms / Button Loading Animations in Rails with jQuery UJS

1. Install font awesome

https://github.com/bokmann/font-awesome-rails

 

2. Use button tag instead of submit tag

 

3. Add data attribute to the button


<%=  f.button 'Update', class: "btn btn-primary btn-md", :name => "update_password", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> Updating..."} %>

 

No issues for this post.

by ryzalyusoff