Star Rating widget for jQuery UI

10,776

I found out, that problem with the version I have downloaded is, that object o is not initialized in the _init function (the defaults from the end of ui.star.js are not loaded). This object also sets the CSS values (classes). I haven't found the solution yet, but a simple workaround would be, to fill those values at initialization of stars on your page:

  <script type="text/javascript">
    $("#stars-wrapper1").stars({
    cancelClass: "ui-stars-cancel",
    starClass: "ui-stars-star",
    starOnClass: "ui-stars-star-on",
    starHoverClass: "ui-stars-star-hover",
    starDisabledClass: "ui-stars-star-disabled",
    cancelHoverClass: "ui-stars-cancel-hover",
    cancelDisabledClass: "ui-stars-cancel-disabled"
    });
  </script>
Share:
10,776
Roger
Author by

Roger

Updated on November 19, 2022

Comments

  • Roger
    Roger over 1 year

    I was introduced to the Star Rating widget for jQuery UI. I was originally using this one.

    Is there any difference between using the two?

    Well trying to use the jquery UI one, I can't get the input buttons to show up as stars. I have these js and css files included:

    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
    <script src="ui.stars.js" type="text/javascript"></script>
    <link href="ui.stars.css" type="text/css" rel="stylesheet" />
    

    And for my code, simply:

    <form>
        Rating: <span id="stars-cap"></span>
        <div id="stars-wrapper1">
            <input type="radio" name="newrate" value="1" title="Very poor" />
            <input type="radio" name="newrate" value="2" title="Poor" />
            <input type="radio" name="newrate" value="3" title="Not that bad" />
            <input type="radio" name="newrate" value="4" title="Fair" />
            <input type="radio" name="newrate" value="5" title="Average" checked="checked" />
            <input type="radio" name="newrate" value="6" title="Almost good" />
            <input type="radio" name="newrate" value="7" title="Good" />
            <input type="radio" name="newrate" value="8" title="Very good" />
            <input type="radio" name="newrate" value="9" title="Excellent" />
            <input type="radio" name="newrate" value="10" title="Perfect" />
        </div>
    </form>
    

    All the files and images are in the same folder. I've never used jquery UI before, so I'm not sure if all I need is that file. I'm not sure if it needs it either, the other star rating plugin I was using didn't require it. Anyone know what I'm missing anything?

  • Roger
    Roger over 14 years
    Weird, I created the images folder and put the ui.stars.gif inside but still no luck.