I have a scenario which i have to use this way of appending lines into table The javascript isn't accepting any input type='text' , for unknown reason, If i put a normal text variable, it is working .I think there is a problem in single quotes / double quotes
<?php
for($counter=0;$row_work_entry=mysqli_fetch_array($run_work_entry);$counter++){
$work_entry_days=$row_work_entry[0];
$work_entry_type_id=$row_work_entry[1];
$totalhours=date('h.i',strtotime($row_work_entry[2]));
$name=$row_work_entry[3];
$code=$row_work_entry[4];
$workingdaystablelines.="<tr><td><input type='text'/></td><td>".$code." </td><td>".$work_entry_days."</td><td>".$totalhours."</td></tr>";
}
?>
<script>
$(document).ready(function(){
var workingdaystablelines ='<?php echo $workingdaystablelines;?>';
$('#worked_days_table').append(workingdaystablelines);
});
</script>
'quote in Javascript is seen as an opening of a string and thus breaking your appendecho htmlspecialchars($workingdaystablelines, ENT_QUOTES);)