title: Cakephp Js helper
body: <p>I am working with Js helper to help me replace the contents of a "div" in my index.ctp with contents of another file changeto.ctp . </p>
  
  <p>This application has a few check boxes with corresponding images. When I select a checkbox, the setting is stored in the database and the corresponding image is to be displayed. Similarly when unchecked, it is to be removed from the database and the image should disappear. </p>
  
  <p>I am using the Js helper for this :  </p>
  
  <p>my changeto.ctp is subset of my index.ctp and has access to same variables and  loads without any problems (except that any click/change events are just not responded to. The names of the Ids of the checkboxes are exactly same). </p>
  
  <p>My index file contains the following Js code at the bottom of all Html:  </p>
  
  <pre><code>$this-&gt;Js-&gt;get($change_checkbox1 )-&gt;event('click',
              $this-&gt;Js-&gt;request(array(
              'controller'=&gt;'testing',
              'action'=&gt;'changeto'
              ), array(
              'update'=&gt;'#changeDiv',
              'async' =&gt; true,
              'method' =&gt; 'post',
              'dataExpression'=&gt;true,
              'data'=&gt; $this-&gt;Js-&gt;serializeForm(array(
                      'isForm' =&gt; false,
                      'inline' =&gt; true
                      ))
              ))
  
      );
  </code></pre>
  
  <p>This is generating the following Jquery/javascript </p>
  
  <pre><code>     $(document).ready(function () {$("#ck0_1_8").bind("click", function (event)      {$.ajax({async:true, data:$("#ck0_1_8").closest("form").serialize(), dataType:"html", success:function (data, textStatus) {$("#changeDiv").html(data);}, type:"post",   url:"\/mytest-site\/options\/testing"});
          return false;});
  
  
  }
  </code></pre>
  
  <p>My controller has a function called  </p>
  
  <pre><code> changeto()
      {
  
       $this-&gt;layout = 'ajax';
      }
  </code></pre>
  
  <p>the first time I click on this the checkbox this works without any problem. However any subsequent clicks don't work. The javascript is not even being called. </p>
  
  <p>My questions are : </p>
  
  <p>Any ideas ? 
  Will it help if I somehow ask cakephp to use  on() / live() insead of bind() .If yes how ?</p>
  
  <p>Thanks!!</p>