我暂时将内容添加到一个名为tempDiv的div中,然后将该div添加到一个显示的div #contentHere中的链接中。我需要清除tempDiv中的内容,以便链接不会相互附加,从而创建一系列没有链接到任何地方的url。
如何在实时清除 div 的临时内容?
$(document).ready(function(){
$.getJSON("data.php", function(data){
for(i = 0; i < 5; i++){
$("#tempDiv").append(data.justIn[i].dataLink+ ' ');
$("#contentHere").append("<a href=\"#tempDiv\">Click to go to the div link</a>");
//I need to clear the contents of tempDiv here
}
});
});
如何在实时清除 div 的临时内容?