I am using bootstrap popover with jquery-raty. I have hidden div showing them on popover with JS function content:. I want to update some attribute in hidden div.
Suppose I've data-rating attribute in hidden div. I want to update data-rating value. I am using following statement.
('#hidden_div_1`).data('rating', '25');
When I print data attribute console.log($('#hidden_div_1').data('rating')); I get 25 which is correct. But when I hover again on particular object to display the popover I get old attribue values. Value is destroying when popover disappeared. I don't know why. Any anyone help?
This is my full jquery code. This is small jsfiddle
Thanks
EDIT 1: $('#hidden_div_1').data('rating', '25');
EDIT 2: It is strange. data-rating value is not changing. I've attached console.log output.

Code >
$('.link-container a').popover({
content : function() { return $(this).siblings('.popover-content').html(); },
trigger: 'click',
html: true
}).click(function(){
$('.ratings').raty({
score: function() { return $(this).attr('data-rating'); },
click: function(score, evt, data) {
//alert(score);
var currentId = $(this).attr('id');
console.log($("#"+currentId).data('rating'));
alert(currentId);
$("#"+currentId).attr('data-rating', score);
console.log($("#"+currentId).data('rating'));
$("#"+currentId).data('rating', score);
console.log($("#"+currentId).data('rating'));
},
path: '/static/img/rating/',
});
});
alert(currentId); printing correct id.