我有一个这样定义的星级评分系统:
<span class="rating_container">
<span class="star_container">
<a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a>
<a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a>
<a rel="nofollow" href="" class="star star_3" >3<span class="rating">Bad</span></a>
<a rel="nofollow" href="" class="star star_4" >4<span class="rating">OK</span></a>
<a rel="nofollow" href="" class="star star_5" >5<span class="rating">OK</span></a>
<a rel="nofollow" href="" class="star star_6" >6<span class="rating">OK</span></a>
<a rel="nofollow" href="" class="star star_7" >7<span class="rating">Good</span></a>
<a rel="nofollow" href="" class="star star_8" >8<span class="rating">Good</span></a>
<a rel="nofollow" href="" class="star star_9" >9<span class="rating">Excellent</span></a>
<a rel="nofollow" href="" class="star star_10" >10<span class="rating">Excellent</span></a>
</span>
</span>
当鼠标悬停时,每个单独的星都被着色。如何用 jquery 模拟这个?例如,我想将鼠标悬停在星号 5 上。这就是我尝试过的:
$('.star.star_5').addClass('active');
我错过了什么?