dreyescat / bootstrap-rating

Bootstrap Rating is a jQuery plugin that creates a rating control that uses Bootstrap glyphicons for rating symbols.
http://dreyescat.github.io/bootstrap-rating/
MIT License
192 stars 78 forks source link

How to make it work in loop? #19

Closed magamlag closed 8 years ago

magamlag commented 8 years ago

Hi, I have a loop $.each , which shows dynamically 6 grades with star rating for each. I tried to inject .rating() to the loop, but no success. How makes .rating() work and show stars for every grade input field in the loop? Thank you.

For example: $i = 0; $.each(response, function (key, value) { i++; $('.input-grade').append(getHtml(i, value.grading_criteria_id, value.grading_criteria.name, value.grading_criteria.description, value.grade )); $('input.grade-rating-' + i).rating({ filled: 'fa fa-star fa-sm', filledSelected: 'fa fa-star fa-sm', empty: 'fa fa-star-o fa-sm' }); });