Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery star rating callback

I've been trying to use this jquery star rating plugin: http://www.fyneworks.com/jquery/star-rating/#tab-Overview. I'm trying to get the value of the star once it's clicked but I've been having no luck. I wasn't sure where to include the following callback they suggest:

$('.auto-submit-star').rating({
    callback: function(value, link){
        alert(value);
    }
});

I've tried sticking it around in the code but I get no alert when I click a star. Thanks!!

like image 898
sad-ducky Avatar asked Dec 28 '22 15:12

sad-ducky


2 Answers

$(function(){
    $('input[type=radio].star').rating();
});

Remove the above lines from the jquery.rating.js, and you are all set. I suppose I don't need to explain why as it's intuitive =)

like image 116
user851126 Avatar answered Jan 07 '23 12:01

user851126


You need to change the class on the radio buttons from star to auto-submit-star, don't just add auto-submit-star to the existing class of star on the radio buttons. For example mine looks like this:

<input name="star1" type="radio" class="auto-submit-star" value="1"/>
like image 20
user947830 Avatar answered Jan 07 '23 12:01

user947830