I am adding rows dynamically to a table. The table already has a row consisting of column headers like date, day etc.
for(var i=0; i<=fix;i++){
var cols = 5;
var tr = $('<tr>');
$('<td name=Date"+i+" id=Date_"+i+"></td>').appendTo(tr);
$('<td id=day_"+ i+">"+theday +"</td>').appendTo(tr);
for (var c = 0; c < cols; c++){
$('<td> <input type=text name=value_"+i+" id=value"+i+"></td>').appendTo(tr);
}
tr.appendTo($('#tbl> tbody:first'))
}
I want to fill the ‘td’s with some vlaues stored in variable. But if i write
$('<td name=Date"+i+" id=Date_"+i+">"+var+"</td>').appendTo(tr);
where var is a variable, Its value does not appear. Instead the whole string is displayed. How can i prefill then with some variable values ?
Do: