I am using the Star Rating widget and I’m trying to set the initial value of the widget from the value I get back from the server. I know the principle is to set the default option to selected but I can’t figure out how. Some widgets have an setDefault method, but not this one, so there must be another way.
Any help would be awesome.
Here is the HTML:
<div id="stars_content" style="padding-top:6px;">
<select id="ContentRating" name="ContentRating">
<option value="1">Very Poor</option>
<option value="2">Poor</option>
<option value="3">OK</option>
<option value="4">Good</option>
<option value="5">Very Good</option>
</select>
<span id="content_hover" style="padding-left:5px;"></span>
</div>
And here is the jQuery:
$("#stars_content").stars({
inputType: "select",
captionEl: $('#content_hover')
});
You could do it manually
that should do it.
EDIT
it appears this widget’s API provides a parameter for this
So your code would be
… I think