07_05_GuyT
07_05_GuyT

Reputation: 2887

Change the button icon from bootstrap is not working

I've the following button and I want to add it bootstrap icon from the following link (the + icon in the begining)and currelntly its not working ,what Im missing here ?

http://getbootstrap.com/components/

This is the button

<div style="float:right; text-align:right;">
    <p>
        <input type="button" class="glyphicon glyphicon-plus"  value="Add Row" onclick="addRow()" id="add-row" />
    </p>
</div>

Upvotes: 2

Views: 1131

Answers (1)

AyB
AyB

Reputation: 11675

The bootstrap button text is inserted via value field which cannot hold an icon, the easiest way to achieve what you are trying to do is to replicate the button using the anchor tag:

<a href="#" onclick="addRow()" id="add-row" class="btn btn-default"><i class="glyphicon glyphicon-plus"></i> Add Row </a>

Giving an anchor class btn btn-default makes it look exactly like a button, and the text can be appended with the icon.

DEMO

Upvotes: 1

Related Questions