I've added an icon to a button like this:
When user adds item into the cart, the button becomes After adding Item
I'm trying to update text of the button whenever the user adds an item to the cart. It is able to update the text but the icon goes missing.
This is the html.
<div class="wrapper">
<button class="btn btn-primary" id="btnView" data-toggle="modal" data-target="#myModal"><i class="fa fa-cart-plus"></i> 0 Item(s) in cart</button>
</div>
This is the css for the wrapper
.wrapper {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
float: right; /* if you had floats before? otherwise inline-block will behave differently */
}
When the user add an item into the cart, I'm updating the text
$('#btnView').text( aItems.length + ' Item(s) in cart' );
Can I update the text while maintaining the icon? Am I missing something?
Thanks guys!