php - Codeigniter access input type inside echoed table -
i have table echoed inside controller , loaded div id via jquery trigger event. problem table consists of input type texts made datepickers it's not working. here code inside controller:
echo "<table class='table table-striped table-borderless' width='100%'> <tbody> <tr> <td><label class='control-label'>awol</label></td> <td><select class='form-control' id='cmbawol1' name='cmbawol1'>"; $awol_code = array(); $awol_code[] = $val['awol']; echo "<option value='".$val['awol']."'>".$val['awol']."</option>"; foreach($data['offense'] $value) { if(!in_array($value['offense'],$awol_code)) { echo "<option value='".$value['offense']."'>".$value['offense']."</option>"; } } echo "</select></td> <td><input type='text' class='form-control' id='txtawol1' name='txtawol1' value='".$date1."'/></td> </tr>
and jquery use create datepicker:
$('#txtawol1').datepicker();
for other pages works because not echoed inside controller. please note table inside edit function meaning have default value database.
i have table structure button on on last column , access via code:
$(document).on('click','#btnviolation',function(){ ............code goes here });
but don't know how input types.
ok solved y own problem , solution:
$(document).on('focus','#txtawol1',function(){ $(this).datepicker(); });
i hope others may find code helpful too.
Comments
Post a Comment