I have to create multiple instances of the same css class to run this block of code which displays user comments and ratings.(In ratings, I set width of lit stars according to comment's rating) So I have to create as many instances of css class as there are comments.
<script>
var wid=<?=$comment->rating?>*20; //20 is the width of 1-star, comment->rating
//gives me rating of that particular comment.
jQuery(function($){
$(".rating-star").css('width',wid); //setting width according to calculated wid.
});
</script>
As there is only one rating-star class, all comments are getting the same star rating. How do I create as many instances of rating-star class as there are comments? Thanks in advance! Great community!
<div class="rating-star" style="width: <?=$comment->rating * 20?>px"></div>