开发者

jQuery Star Rating Plugin

开发者 https://www.devze.com 2023-02-20 09:10 出处:网络
I am playing with star rating plugin, but I can\'t configure it correctly, to show hover label on the right side, like on this page Test-3B:

I am playing with star rating plugin, but I can't configure it correctly, to show hover label on the right side, like on this page Test-3B:

http://www.fyneworks.com/jquery/star-rating/#tab-Testing

<script>
$(function(){
$('.star').rating({
focus: function(value, link){
// 'this' is the hidden form element holding the current value
// 'value' is the value selected
// 'element' points to the link element that received the click.
var tip = $('#hover-test');
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: '+value);
},
blur: function(value, link){
var tip = $('#hover-test');
$('#hover-test').html(tip[0].data || '');
}
});
});

</script>
<input type="radio" name="rating" value="1" style="margin: 0;" class="star"  title="Very     poor"/>
    &nbsp;
<input type="radio" name="rating" value="2" style="margin: 0;" class="star" title="Poor"/>
    &nbsp;
<input type="radio" name="rating" value="3" style="margin: 0;" class=开发者_StackOverflow社区"star" title="OK"/>
    &nbsp;
<input type="radio" name="rating" value="4" style="margin: 0;" class="star" title="Good"/>
    &nbsp;
<input type="radio" name="rating" value="5" style="margin: 0;" class="star" title="Very good"/>
<span id="hover-test" style="margin:0 0 0 20px;">Hover tips will appear in here</span><br />


I tried your plugin and it works great.

I put the source code here : http://jsfiddle.net/VgWtG/

You can test it by yourself. For your code, try to put <script type='text/javascript'> instead of </script>. Then, surround your set of inputs with a div.

But i'm pretty sure that your problem comes from a missing include (check it in the source code I gave you). Regards.

0

精彩评论

暂无评论...
验证码 换一张
取 消