views:

39

answers:

1

This problem only occurs using IE (only tested in IE 7, works fine in firefox/chrome).

I've got an empty table element on my page with id='settings'. After an ajax call executes I place the results of said ajax call into my empty table element like so:

$("#settings").html(msg);

Well that just isn't working... if I alert(msg); I see the html that should be placed into that empty table. The html is valid but for some reason IE7 just isn't rendering it.

I tinkered around for a while and finally tried this:

$(msg).appendTo("#settings");

Like magic this has some how fixed the issue. Any ideas why the appendTo() method would work but not the html() method?

Thanks!

+2  A: 

IE needs a tbody tag for this to work ;)

Johan
It makes for a correctly formatted table. The other browsers (in this case) are a bit more forgiving.
Buggabill
@Johan: Assuming that your solution does work (I haven't tried it yet because what I did makes it work and I'm being lazy about making any more alterations to it), why? Does appendTo create the <tbody></tbody> tags automatically w/i the empty table tags before appending the msg to it?
Ryan