Hello there,
I had an issue with the plugin when using the onSelect Callback when i set the rating using the set method or by using the initialRating !
The solution took some while but was easy to solve.
I would like to share it with you when someone face the same issue !
I hope this issue get solved in future updates !
The walkaround solution is :
$("#example").barrating("show", {
theme: "my-awesome-theme",
onSelect: function (value, text, event) {
if (typeof (event) !== "undefined") {
// rating was selected by a user
console.log(event.target);
//Get the selected value from the event
var selectedValue = $(event.target).data("rating-value");
console.log("Selected value :" + selectedValue);
} else {
// rating was selected programmatically
// by calling "set" method
}
}
});
just use $(event.target).data('rating-value') and you will get the selected value even if it was set programmatically and only the onSelect returns an empty value.
Hello there, I had an issue with the plugin when using the onSelect Callback when i set the rating using the set method or by using the initialRating ! The solution took some while but was easy to solve. I would like to share it with you when someone face the same issue ! I hope this issue get solved in future updates ! The walkaround solution is :
just use
$(event.target).data('rating-value')
and you will get the selected value even if it was set programmatically and only the onSelect returns an empty value.Best of luck :)