This is very easy to use, just copy-paste the code. You can use your own star image in background.
I have created a variable var userRating
. you can use this variable to get value from stars.
Enjoy!! :)
$(document).ready(function(){_x000D_
// Check Radio-box_x000D_
$(".rating input:radio").attr("checked", false);_x000D_
_x000D_
$('.rating input').click(function () {_x000D_
$(".rating span").removeClass('checked');_x000D_
$(this).parent().addClass('checked');_x000D_
});_x000D_
_x000D_
$('input:radio').change(_x000D_
function(){_x000D_
var userRating = this.value;_x000D_
alert(userRating);_x000D_
}); _x000D_
});
_x000D_
.rating {_x000D_
float:left;_x000D_
width:300px;_x000D_
}_x000D_
.rating span { float:right; position:relative; }_x000D_
.rating span input {_x000D_
position:absolute;_x000D_
top:0px;_x000D_
left:0px;_x000D_
opacity:0;_x000D_
}_x000D_
.rating span label {_x000D_
display:inline-block;_x000D_
width:30px;_x000D_
height:30px;_x000D_
text-align:center;_x000D_
color:#FFF;_x000D_
background:#ccc;_x000D_
font-size:30px;_x000D_
margin-right:2px;_x000D_
line-height:30px;_x000D_
border-radius:50%;_x000D_
-webkit-border-radius:50%;_x000D_
}_x000D_
.rating span:hover ~ span label,_x000D_
.rating span:hover label,_x000D_
.rating span.checked label,_x000D_
.rating span.checked ~ span label {_x000D_
background:#F90;_x000D_
color:#FFF;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<div class="rating">_x000D_
<span><input type="radio" name="rating" id="str5" value="5"><label for="str5"></label></span>_x000D_
<span><input type="radio" name="rating" id="str4" value="4"><label for="str4"></label></span>_x000D_
<span><input type="radio" name="rating" id="str3" value="3"><label for="str3"></label></span>_x000D_
<span><input type="radio" name="rating" id="str2" value="2"><label for="str2"></label></span>_x000D_
<span><input type="radio" name="rating" id="str1" value="1"><label for="str1"></label></span>_x000D_
</div>
_x000D_