title: How to bind events to element generated by ajax
body: <p>I am using <code>RenderPartial</code> to generate <code>CListView</code> and all the contents generated properly and good pagination is working fine too. But when I added my custom JS to elements generated by the <code>CListview</code> it works fine for the the fist page content but when i use pagination and click to page 2 then the JS binding fails.</p>
  
  <p>Is there any other way to bind custom event to elements generated in YII <code>CListview</code> I had tried using live, and on nothing work for me here is my js file.</p>
  
  <p>I think I have to call my function on every ajax load in but how can I achieve in yii </p>
  
  <p>This is the script I am using to update ratings on server with button click and this the element for which these forms and buttons are defined are generated by <code>CListview</code> in yii</p>
  
  <pre><code>$(document).ready(function(){
      $('form[id^="rating_formup_"]').each(function() {
          $(this).live('click', function() {
              alert("hi");
              var profileid=  $(this).find('#profile_id').attr('value');
              var userid=  $(this).find('#user_id').attr('value');  
              console.log(userid);
              var data = new Object();
              data.profile_id=profileid;
              data.user_id=userid;
              data.liked="Liked";
              $.post('profile_rating_ajax.php', data, handleAjaxResponse);
              return false;     
         });
      });
  });
  </code></pre>