Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8838593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:02:24+00:00 2026-06-14T10:02:24+00:00

I am using Bootstrap and want to put an icon in the submit button

  • 0

I am using Bootstrap and want to put an icon in the submit button for a form.
here is the code:

<%= f.submit "Submit for Approval <i class='icon-share-alt icon-white'></i>", 
                                class: "button_green" %>

Generated HTML:

<input type="submit" value="Submit for Approval &lt;i class='icon-share-alt icon-white'&gt;&lt;/i&gt;" name="commit" class="button_green">

I tried adding both raw and html_safe to the text but neither one seemed to work.
I know one solution would be to have the class be an image with the icon in it already but I would like to do this without creating additional images/css. any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:02:26+00:00Added an answer on June 14, 2026 at 10:02 am

    You can do this by using the button_tag instead:

    <%= button_tag( :class => "button_green") do %>
      Submit for Approval <i class="icon-share-alt icon-white"></i>
    <% end %>
    

    This will create a <button type="submit"></button> element with the icon and wordage inside. I’ve tested and it works. The default action for button_tag is to submit, so if you need a different action (like cancel for example), you can use the :type => "button" option to override the default submit behavior.

    Edit: For Bootstrap 3, the icon class names have changed, so you would put

    <span class="glyphicon-white glyphicon-share-alt white"></span>
    

    Notice, there is no longer a special class for white icons. Just make a css class .white and put color: #fff;. Simple. You can use any color or text style you like, since the icons are now a font.

    Related Question: Add Icon to Submit Button in Twitter Bootstrap 2, and How do I change Bootstrap 3’s glyphicons to white?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using RoR 3.1 and Twitter Bootstrap, and want to create a button that
I have a simple form with a legend using Twitter Bootstrap. I want to
I'm using bootstrap and I want to create a form in a popover. I've
I'm using Bootstrap and I want to change color of caret, when it is
I'm using Twitter Bootstrap and I want to make dropdown look like this: and
I am using Asp.net MVC 3 and Twitter Bootstrap. What I want is to
i'm using twitter bootstrap 2.0.4. i want to populate the dropdown using ajax. the
I want to user NoSqlEntityManagerFactory create(Map properties) method in Bootstrap class to create a
I am using bootstrap,however I found some problems if I want to delete some
I'm using Twitter Bootstrap for my page layout and I want to insert a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.