我正在实现jquery 星级插件。
单颗星估算工作正常,没问题。但我似乎无法得到半颗星的工作......
html源码:
<div class="stars">
<span class="star-rating-control"><div class="rating-cancel" style="display: none;"><a title="Cancel Rating"></a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="1">1</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="2">2</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="3">3</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="4">4</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="5">5</a></div></span>
<input class="required {half:true} star-rating-applied" data-val="true" data-val-required="The Rating field is required." id="Answer1_Rating" name="Answer1.Rating" type="radio" value="1" style="display: none;">
<input class="required {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="2" style="display: none;">
<input class="required {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="3" style="display: none;">
<input class="required {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="4" style="display: none;">
<input class="required {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="5" style="display: none;">
</div>
查询:
$('.stars :radio').rating();