IE8/IE9 append row table disappear

Suppose to have this table on the page:

<table border="1" id="TABLEID">
 <thead><tr><th>col1</th><th>col2</th><th>col3</th><th>col3</th><th>col6</th><th>col7</th></tr></thead>
 <tbody></tbody>
 </table>

Now suppose you want to append some row with jQuery, row returned by AJAX call as string containig ‘<tr>…</tr>’, with the code:

$('#TABLEID').empty();
 var t=$('#TABLEID');
 var b = t.find('tbody');

 if (b.length == 0) {
 t.append(msg.d);
}

If the string contain tailing space in IE8 and IE9 when the append is executed the entire table disappear!

 


Pubblicato

in

da