I'm using this plugin http://www.fyneworks.com/jquery/star-rating/#tab-Testing. I was attempting to make a client-side validation system which figures out whether stars have been clicked. I was wondering how you can do it.
In my javascript file, I have
$('#star1').click(function (){
document.getElementById('star1').checked=true;
return false;
});
I'm using radio button typed stars and have html code like this,
<input id="star1" name="star1" type="radio" class="star" value="1"/>
<input id="star1" name="star1" type="radio" class="star" value="2"/>
<input id="star1" name="star1" type="radio" class="star" value="3"/>
<input id="star1" name="star1" type="radio" class="star" value="4"/>
<input id="star1" name="star1" type="radio" class="star" value="5"/>
But this doesn't seem to work.
Working demo http://jsfiddle.net/2xTwb/
Hope it fit your cause :)
scripts
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript' src="http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.js"></script>
<link rel="stylesheet" type="text/css" href="http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.css">
code
$(".voting-star[value='3']").attr("checked", true);
$('.voting-star').rating({
callback: function(value, link) {
alert(value);
}
});