开发者

jquery append element from string + do not close tags properly

I have the following string elements that i want to append to the DOM, but in IE the tags do no close. Example:

$("#accordion").append('<div id="mydiv" class="sortme">bla bla bla</div><div id="panel" class="accordionPanel"></div>');

After IE render it the div elements for instance are rendered without closing tag. It was supposed to be "" and only shows ""

Any ideas what might be happe开发者_开发知识库nning here?

Thanks, TT


Your tags aren't balanced:

<div id="mydiv" class="sortme">
bla bla bla
</div>
<div id="panel" class="accordionPanel">
</div>
</div>

ie you have an extra </div> at the end.


Try inserting the two divs with two separate append calls. I seem to recall a bug where trying to insert multiple sibling elements at once failed in IE.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜