I have an empty-star button like this,
<button type="button" class="btn btn-default btn-lg" id="refresh">
<span class="glyphicon glyphicon-star-empty"></span>
</button>
When I click it, I want the inner color to change to yellow like shown here - http://s21.postimg.org/3qwgsnrcj/star.png
How can we achieve this using Bootstrap and Javascript?
Here's a link to what I've got so far - http://jsbin.com/refatelefi/edit?html,output
A glyphicon is like a character. You can change it's color by changing the color property of the span style.
<button type="button" class="btn btn-default btn-lg" id="refresh">
<span class="glyphicon glyphicon-star-empty"></span>
</button>
.glyphicon-star-empty {
color: yellow;
}
However, the icon you picked is not full, so you can't change the inside as you asked. I would recommend using the "glyphicon glyphicon-star" instead.
<button type="button" class="btn btn-default btn-lg" id="refresh">
<span class="glyphicon glyphicon-star"></span>
</button>
.glyphicon-star {
color: yellow;
}
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