开发者

Why can I append to an empty table but not set its html via jQuery in IE7?

开发者 https://www.devze.com 2023-01-15 22:05 出处:网络
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\'.

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 f开发者_运维知识库or 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!


IE needs a tbody tag for this to work ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消