Original Plugin: jQuery Star Rating Plugin
I forked and updated this plugin to support setting some configuration according to needs
- set the number of stars by JavaScript
- set the data-caseno and you can get it by callback function after clicking the stars
- set the number of starts that should light up by value (html attribute reference)
- bring callback function to be a configuration key
<link rel="stylesheet" type="text/css" src="rating.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="rating.js"></script>
<section class="starRate"></section>
Write just a line code inside the document.ready function.
$('.starRate').rating();
<!-- default 5 stars and none of one is light up-->
<section class="starRate"></section>
<!-- set the light up number by value / can carry a data that want to get by set data-caseno-->
<section class="starRate" value="3" data-caseno="A0001"></section>
$('.starRate').rating();
$('.starRate').rating({
starNum: 8,
callback: function (caseno, vote, event) {
console.log('val:' + vote, ' caseno:' + caseno);
}
});
This plugin was inspired by jQuery Star Rating Plugin .