[英]Jquery prepend() adding extra unwanted tags
I am trying to prepend html element into div in windows 8.1 phonegap application but its giving some weird output. 我正在尝试在Windows 8.1 phonegap应用程序中将html元素添加到div中,但是它给出了一些奇怪的输出。 Please see below code which I am using to prepend element.
请参阅下面我用来添加元素的代码。
var wrapper = $('.list');
wrapper.prepend("<div> Hello </div>");
It should give output like this 它应该给出这样的输出
<div class="list">
<div> Hello </div>
</div>
But giving some weird output 但是给出一些奇怪的输出
<div class="list">
<head></head>
<body onload="startExec()">
<div> Hello </div>
</body>
</div>
Please get back on this as soon as possible. 请尽快恢复。
Update 更新
I am adding JavaScript Dynamic Content shim for Windows Store apps ie winstore-jscompat. 我正在为Windows应用商店应用程序添加JavaScript动态内容填充程序,即winstore-jscompat。 Is this issue coming because of shim?
是因为垫片引起的问题?
试试这个
$('div.list').prepend("<div> Hello </div>");
I Know this is a bit late - but better late than never :) 我知道这有点晚-但总比没有好:)
You have pointed out the issue your self: The cause is winstore-jscompat. 您已经指出了您自己的问题:原因是winstore-jscompat。
Get the latest version that fixes this issue here: https://github.com/MSOpenTech/winstore-jscompat 在此处获取可解决此问题的最新版本: https : //github.com/MSOpenTech/winstore-jscompat
I had this issue my self, and just verified that the newest version fixes it. 我自己有这个问题,只是验证了最新版本已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.