Assume I have the following css:
<style>
.liked {
color: #600;
}
.not-liked {
color: #aaa;
}
</style>
Assuming I have this: <i class = 'fa fa-heart-o not-liked' id = "banner"></i>
in my jQuery, if I swap classes from not-liked
to liked
can I also swap fa-heart-o to fa-heart in the same class?
So I'm trying to avoid this:
function() {
$("#banner").removeClass('not-liked');
$("#banner").removeClass('fa-heart-o');
$("#banner").addClass('liked');
$("#banner").addClass('fa-heart');
}
and basically switch the colour and the icon with this:
function() {
$("#banner").removeClass('not-liked');
$("#banner").addClass('liked');
}