title: Codeigniter access input type inside echoed table
body: <p>I have a table echoed inside from controller and loaded into a div id via jquery trigger event. The problem is that the table consists of input type texts that I made to datepickers but it's not working. Here is my code inside the controller:</p>
  
  <pre><code>echo "&lt;table class='table table-striped table-borderless' width='100%'&gt;
                 &lt;tbody&gt;
                  &lt;tr&gt;
                   &lt;td&gt;&lt;label class='control-label'&gt;AWOL&lt;/label&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;select class='form-control' id='cmbawol1' name='cmbawol1'&gt;";
                     $awol_code = array();
                     $awol_code[] = $val['AWOL'];
                     echo "&lt;option value='".$val['AWOL']."'&gt;".$val['AWOL']."&lt;/option&gt;";
                     foreach($data['offense'] as $value)
                     {
                      if(!in_array($value['Offense'],$awol_code))
                      {
                          echo "&lt;option value='".$value['Offense']."'&gt;".$value['Offense']."&lt;/option&gt;";
                      }
                     }
                     echo "&lt;/select&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type='text' class='form-control' id='txtawol1' name='txtawol1' value='".$date1."'/&gt;&lt;/td&gt;
                       &lt;/tr&gt;
  </code></pre>
  
  <p>and this is the jQuery that I always use to create datepicker:</p>
  
  <pre><code>$('#txtawol1').datepicker();
  </code></pre>
  
  <p>For other pages it works because they are not echoed inside the controller. Please note that this table is inside my edit function meaning it have a default value from my database.</p>
  
  <p>I have the table structure with button on  on the last column and I access it via this code:</p>
  
  <pre><code>$(document).on('click','#btnviolation',function(){
     ............code goes here
  });
  </code></pre>
  
  <p>But I don't know how for input types.</p>