0
我使用http://antenna.io/demo/jquery-bar-rating/examples/为表中的人员设置多个评分。一切正常,但我不能 选择的数据属性的相应值传递到评级功能,因此它保存正确的人的评级。jQuery barrating.js - 发送ID数据
$('.rating').each(function(index, value) {
var dataId = $(this).closest('select').attr("data-rating-candidate");
//console.log(dataId);
$('.rating').barrating('show', {
theme: 'bars-1to10',
onSelect: function(rating, text, event) {
if (typeof(event) !== 'undefined') {
console.log(dataId);
}
}
});
});
显然,只有最后一次传递的属性值用于dataId变量。那么,如何才能为选定的评分获得正确的评分?我似乎无法在barrating选项中使用$ this?
谢谢,这有帮助! – Chris