I am using star rating plugin and in the star selection its return value in number that I am able to use it. Now I want to add another functionality on this that is, when I select star 1, it should show some message and the similar with star2, star 3 and so on.
The value of each star selection would in the array, but I am not able to print successfully, following
How do I show the message on each star selected?
$('rating').starrr({
change: function(e, value) {
console.log(value);
//this is message
var ratingMsgs = [
'star 1 selected',
'star 2 selected',
'star 3 selected',
'star 4 selected',
'star 5 selected'
];
var ratingMsg = $("p.message");
//This is just showing the first value, but I want to value conditionally
ratingMsg.removeClass('hidden').append(ratingMsgs[0]);
}
});
console.log(value);ratingMsgs[0]toratingMsgs[value]