我正在使用这个Jquery评级的bootstrap popover。 http://www.fyneworks.com/jquery/star-rating/ 现在评级没有显示在popover中(显示为单选按钮),我意识到这是因为我需要再次加载评级,所以我尝试了以下代码,仍然无法正常工作......
有什么想法吗?
<script>
$(function(){
$('.review').popover({
placement: 'in right',
html: true,
title: 'Reviews',
content: $('.review-content').html()
}).click(function(id,data){
("input").rating({"readOnly":true});
});
});
</script>
以下是.review和review-content
的一些标记<a class="review" style="color:black; position:relative;" href="#">Review</a>
<div class="review-content" style="display:none;" >
<span id="avg1">
<span class="star-rating-control"><div class="rating-cancel" style="display: none;"><a title="Cancel Rating"></a></div><div class="star-rating rater-0 star-rating-applied star-rating-readonly star-rating-on" id="avg1_0"><a title="1">1</a></div><div class="star-rating rater-0 star-rating-applied star-rating-readonly star-rating-on" id="avg1_1"><a title="2">2</a></div><div class="star-rating rater-0 star-rating-applied star-rating-readonly star-rating-on" id="avg1_2"><a title="3">3</a></div><div class="star-rating rater-0 star-rating-applied star-rating-readonly star-rating-on" id="avg1_3"><a title="4">4</a></div><div class="star-rating rater-0 star-rating-applied star-rating-readonly star-rating-on" id="avg1_4"><a title="5">5</a></div></span><input type="radio" name="avg1" value="1" id="avg1_0" class="star-rating-applied star-rating-readonly" style="display: none;">
<input type="radio" name="avg1" value="2" id="avg1_1" class="star-rating-applied star-rating-readonly" style="display: none;">
<input type="radio" name="avg1" value="3" id="avg1_2" class="star-rating-applied star-rating-readonly" style="display: none;">
<input type="radio" name="avg1" value="4" id="avg1_3" class="star-rating-applied star-rating-readonly" style="display: none;">
<input type="radio" name="avg1" checked="checked" value="5" id="avg1_4" class="star-rating-applied star-rating-readonly" style="display: none;">
</span>
</div>
答案 0 :(得分:0)
这有用吗?
$(function(){
$('.review').popover({
placement: 'in right',
html: true,
title: 'Reviews',
content: function(){
return $('.review-content').html()
}
}).click(function(id,data){
(".popover-content input").rating({"readOnly":true});
});
});