开发者

jQuery append() is broken in IE?

开发者 https://www.devze.com 2023-04-07 09:22 出处:网络
Is jQuery 1.6.4 append() is brok开发者_如何学Goen in IE? This code works everywhere but IE6+ $(\'<xml></xml>\').append(\'<test>hello world</test>\');

Is jQuery 1.6.4 append() is brok开发者_如何学Goen in IE?

This code works everywhere but IE6+

$('<xml></xml>').append('<test>hello world</test>');

Is there a way to fix that?


From the docs:

jQuery( html, [ownerDocument] )

html A string of HTML to create on the fly. Note that this parses HTML, not XML.

The argument passed to jQuery is not HTML(there is no html-element xml) so there will be nothing to append something to.

Take a look at MSDN for informations about creation of XML-Documents in IE<9

0

精彩评论

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