← Understanding Semantic Versioning jQuery UJS and AJAX →


16. Button Loading Animations with jQuery UJS

Download

June 7, 2015

Gravatar Gravatar Gravatar Gravatar Gravatar Gravatar Gravatar Gravatar 8

Learn how to easily disable the submit button and display a loading animation when a user submits the form


Code

Standard Rails
erb
<%= f.button "Sign In", class: "btn btn-success", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> Signing in..."} %>

SimpleForm
erb
<%= f.button :button, "Save Post".html_safe, data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> Saving..."} %>

Resources


Discussion