What you're trying to do is really difficult to do correctly. This is because a <TR>
element is meaningless outside the scope of a <TABLE>
. While interpreting your intent is easy for us humans, it's very possible that jQuery is not smart enough to do it, and do the right thing.
The right thing here would be something like:
var tbody = document.getElementById('myTable').getElementsByTagName('tbody')[0];
var row = document.createElement('tr');
tbody.appendChild(row);
var cell = document.createElement('td');
cell.innerHTML = '1';
row.appendChild(cell);
cell = document.createElement('td');
cell.innerHTML = 'A';
row.appendChild(cell);
Now the code in your question is admittedly much more compact, but that doesn't mean that jQuery will need to do much less work behind the scenes to actually achieve desired results.