below is the javascript table genertion for json response.here my problem is css for table row and data is not working but css for table header works.note:the css given below works well for other normal tables
var table = $('#mydemo1');
for (var i = 0; i <= result.length; i++)
{
var doc1 = result[i];
var tr = $("<tr><td>").html(doc1.Name).data(doc1);
tr.append($("</td></tr>"));
table.append(tr);
}
.mytdemo1 td
{
font-family:Arial, sans-serif;
font-size:14px;
padding:10px 7px;
border-style:solid;
border-width:0px;
overflow:hidden;
word-break:normal;
border-color:red;
color:#444;
background-color:#F7FDFA;
}
.mytdemo1 th
{
font-family:Arial, sans-serif;
font-size:14px;
font-weight:normal;
padding:10px 7px;
border-style:solid;
border-width:0px;
overflow:hidden;
word-break:normal;
border-color:red;
color:#fff;
background-color:#26ADE4;
}
.mytdemo1 .mytdemo1-yw4l{vertical-align:top}
<table class="mytdemo1" id="mydemo1" style="display:none;border-collapse: collapse; border-color:red;" border="1" >
<tr><th>Employee Name</th></tr>
</table>
$("<tr><td>"), You can not create nodes this way. The string should contain a valid HTML markup. If you check your page source, you will see that the HTML will not be generated the way you want it to be and therefore your CSS properties are not applied properly. See THIS