10.02.2021, 09:59
Like this:
Code:
$(function() {
$('.color-by-value').each(function(_, el) {
var addr = $(el).data('object');
if (addr) {
grp.listen(addr, function(obj) {
var color;
if (obj.value) {
color = 'green';
}
else {
color = 'red';
}
$(el).css('color', color);
});
}
});
});