Eirtaza Eirtaza - 2 months ago 11
Javascript Question

Rateit plugin not working for content appended after page load

I am using rateit plugin by http://gjunge.github.io/rateit.js/examples/

Every thing works fine until i load content with starts on page dynamically after page load. Stars simply don't appear.

My dynamically generated content which is appended to the page looks likes this(form ajax request):

<div class="caption">
<p id="productNameInFeeds"><a href="https://youlense.com/view/IPHONE">
<b>IPHONE</b></a> - I PHONE 6S</p>
<div class="rateit" data-rateit-value="3.00"
data-rateit-ispreset="true" data-rateit-readonly="true" data-rateit-max="10">
3.00 Stars | 2 Reviews | 10 Views | 1 Followers

my js file looks likes this

$(document).ready(function() {
var page = 1;

page: page
function(data, status){

if(data != ''){
page = page + 1;

$('div.rateit, span.rateit').rateit();


Can anyone tell me the solution?

Thanks in advance


Found this: http://stackoverflow.com/a/33071447/3499595

Just after you append the new content, call this:

$('div.rateit, span.rateit').rateit();

This initializes all the rateit elements.