Add Icon To Submit Button In Twitter Bootstrap 2


Answer :

You can use a button tag instead of input

<button type="submit" class="btn btn-primary">   <i class="icon-user icon-white"></i> Sign in </button> 

I think you can use label tags for this purpose. Here is a sample of the twitter bootstrap HTML navbar:

<form class="navbar-search">     <input type="text" class="search-query" placeholder="Search here" />             <label for="mySubmit" class="btn"><i class="icon-search icon-white"></i> Search me</label>     <input id="mySubmit" type="submit" value="Go" class="hidden" /> </form> 

Basically you get a label element for the input (type=submit) and then you hide the actual input submit. Users can click on the label element and still get through with the form submission.


I think you should try this FontAwesome designed to be use with Twitter Bootstrap.

<button class="btn btn-primary icon-save">Button With Icon</button> 

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable