I am using the jQuery Star Rating Plugin. When the page is loaded a dynamic value should be set with the posibility of changing that in a jquery dialog with the new selected value. I have something like this:
$("input#currentRatingDisplay").rating('select', '${rating}');// dynamic value that does not get selected?!?
$("input#currentRatingDisplay").rating({
callback: function(value, link){
$("#rateIt").rating('select', value, false); // stars in ui dialog to get persisted in the db
$("#dialog-rating" ).dialog("open");
}
});
The callback function with value transfer to the stars in dialog works but the problem is that the initial rating is not selected. Any ideas? Also - is there a way to get read of the reset button? Thanks.
No need for javascript to do that. As the site says: Use the checked property to specify the initial/default value of the control.
So something like:
<c:forEach var="random" items="${item}">
<c:if test="${fn:item == rating}">
<input name="star2" type="radio" class="star" checked="checked"/>
<c: else>
<input name="star2" type="radio" class="star"/>
</c:forEach>