Closed rodrigogalura closed 7 years ago
There is already a way to be notified when the rate is changed. The rating control wraps an input where you can just attach your change
handler:
$('input').rating().on('change', function () {
$(this).next('.label').text($(this).val());
});
Check this jsfiddle.
I prefer not using a callback for this kind of notification. I see events more appropriate.
Maybe, as an improvement, we could add a custom event rating.change
similar to those thrown on symbol rate enter and leave.
$input.trigger('rating.rate', [rating._indexToRate(fractionalIndex(e))]);
This would allow you to attach as many event handlers as you want like this:
$('.rating').on('rating.rate', function (e, rate) {
window.alert('Rate: ' + rate);
})
oh I see 👍, thanks @dreyescat.
But there is one thing, When you put fractions: 2 in the option and you implement tooltip. The rate is not accurate. Check this jsfiddle
Check Symbol events section. I think this is what you are looking for. You can see one fractional rating with tooltips in the demo page.
Add callback and rate argument after the user click or rate.