Skip to main content

11 Button Loading Animations with jQuery UJS


Episode 16 · June 7, 2015 · Download

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