I add content of table in Javascript like this
function (data) {
$("#forum-content").html(data);
}
data is a string with table content("<tr>...</tr><tr>...</tr>..."
) and I want to add that content to my table.
<table id="forum-content"></table>
In majority browsers it's look fine, but in IE 7 after adding content I don't see table anyway... I check that problem is that IE 7 is calculating size of my table 0(width=0,height=0) after adding content.
How can I solve this issue?
You should avoid writing a table body like that. In IE tables have been traditionally very fragile when using innerHTML
(which jQuery's html()
method basically is).
Try building the whole table instead:
function (data) {
$("#forum-content").html("<table>" + data + "</table>");
}
with
<div id="forum-content"></div>