I have a f.submit in a form. I want to add a font awesome icon to it. But Im not able to.
<%= f.submit "Register", class: "button my-button", id: "register-button" %>
how can I add a font awesome icon <i class="fa fa-lock" aria-hidden="true"></i>
to it ??
another alternative is button_tag
<%= button_tag type: 'submit', class: "button my-button", id: "register-button" do %>
<i class="fa fa-lock" aria-hidden="true"></i>
<% end %>
With gem font-awesome
<%= f.button fa_icon("lock", text: "Register"), class: "button my-button", id: "register-button" %>
With plain Rails:
<%= f.button'<i class="fa fa-lock" aria-hidden="true"></i> Register'.html_safe, class: "button my-button", id: "register-button" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With