javascript does not work with pagination
<p>am doing pagination of table in php with phtml.The problem is I have a javascript to change the color of the row.It works only for my first page,doesnt work with other pages.</p>

<pre><code>foreach($this-&gt;paginator as $record)
       {echo "&lt;td width='61'&gt; &lt;a href='#' class='test'  data-id='" . $record['id']. "'&gt;". $record['id'] . "&lt;/td&gt;";
       echo "&lt;td width='61'  &gt;". $record['firstname'] . "&lt;/td&gt;";
       echo "&lt;td width='61'&gt;" . $record['emailid'] . "&lt;/a&gt;&lt;/td&gt;";
       echo "&lt;td width='38'&gt;" . $record['customdata'] . "&lt;/td&gt;";
}
</code></pre>

<p>Javascript is</p>

<pre><code>function approve(id) {

   var id =id;  
   $.ajax({
       url: 'http://localhost/feedback/public/index/approve/',
       type: 'POST',                    
       data:"id="+id,
       success:function(data) {
                 alert('Approved successfully');
                     var index =parseFloat(id)+1;                                    
                    $('table tr:eq('+index+')').css("background-color", "54FF9F");//this           works only for first page
                    }
           })   
    }  
</code></pre>

<p>I'm calling javascript in onclick of a button in popup window.Can anyone help me y it doesnot work for other pages</p>
