Search code examples
jqueryrating

jquery star rating - raty plugin bug


i am using jquery star rating plugin. I have a very problem: i ask for 5 stars - the html page would display 10 stars (apparently they repeat themselves)

i use the following scripts:

$('#rating').raty({
        readOnly: true,
    //  number: 5,          
        start: 0
    });

and i went through the javascript, the default is also set to 5. Hence whether or not i set it to five it will automatically be five. But, on the html page: the number of stars are 10 to my surprise.

image from my fire bug: in this case, i ask for 4 stars, turnout to have 8 stars.

enter image description here

is this bug from the plugin itself or has to do with my codes?


Solution

  • Use different names for id :

    rating1-1 rating1-2 rating1-3 etc

    rating2-1 rating2-2 rating2-3 etc

    Example

    EDIT :

    You use twice or more Raty in your page ? If so, you should do it like this:

    <div id="rating1"></div>
    $('#rating1').Raty(etc.
    
    <div id="rating2"></div>
    $('#rating2').Raty(etc.