1
What I want to do is to pass the mouse over some star, all the previous ones including it was with a "selected" class, I tried to use siblings along with each and almost got the result where I wanted to.
The result I want to arrive at is something like this: JQUERY
$('.estrela').on({
'mouseenter': function () {
$(this).siblings().each(function () {
$(this).removeClass("fa-star-o").addClass("fa-star");
});
}, 'mouseleave': function () {
$(this).removeClass("fa-star").addClass("fa-star-o");
}
});
HTML
<form>
<h5>1 - Quantas estrelas você recomenda?</h5>
<?php for ($i = 1; $i <= 5; $i++): ?>
<a href="#" class="estrela fa fa-star-o" data-estrelas="<?= $i; ?>"></a>
<?php endfor; ?>
</form>
Thank you Sergio, that’s exactly what I wanted!
– viniciussvl