我正在尝试以这种方式附加外部 html 内容(div 加上一些文本仅用于测试):
$.get("banner.html", function(data){
$(this).children("div:first").append(data);
});
这似乎很简单......但似乎不起作用。任何想法?谢谢!
最佳答案
使用 html 而不是附加:
$.get("banner.html", function(data){
$(this).children("div:first").html(data);
});
关于jquery 将外部 html 文件附加到我的页面中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8277462/