0
文件后,被删除:a.html标识和标签的jQuery负载
...
// JavaScript function
function abc(id)
{
$("#body").load("b.html");
var m = document.getElementById("bbb");
// id and tag is removed after load, bbb can not be found. m is null
if (m != null)
{
m.innerText = "XYZ";
}
}
...
// HTML
<div id="body">
</div>
FILE:b.html
<div id="bbb" tag="bbb" onclick="DoOnClick()">
</div>
标签和ID jQuery.load之后被删除。 如何在加载后保留ID或标签?
'负载()'是异步,使用完整的回调http://api.jquery.com/load/#callback-function –
添加到^^^'$( “#体”)。负载(“b.html”,function(){var m = document.getElementById(“bbb”); //});'' – Satpal