for (value of this.IDS) { $('#' + value).barrating({ theme: 'fontawesome-stars', showSelectedRating: false, initialRating: this, onSelect: function (value, text, event){ var obj = this.$elem[0]; if (value == 5) { var companyID = $(obj).data('companyid'); _this.allCorrect(value, companyID) } else { var companyName = $(obj).data('name'); _this.notAllCorrect(value, companyName, event); } }, }); }