如何加载一些HTML并追加到< body>用jQuery? [英] How to load some html and append to <body> with jQuery?
本文介绍了如何加载一些HTML并追加到< body>用jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了以下操作:
$.load("Views/chatBox.html").appendTo('body') is not working!
TypeError: $.load is not a function
编辑:答案应该只有一行代码,我想就足够了
EDIT:The answer should be only one line of code,that's enough,I think
推荐答案
我不明白为什么不需要将容器放在主体底部并将外部页面加载到其中?
I dont understand why placing container at the bottom of body and loading external page into that is not what you need?
您可以尝试的是这样:
<script type="text/javascript">
$(function() {
$("#container").load("Views/chatBox.html",function(){
$(this).clone().appendTo("body").remove();
});
});
</script>
但是我不是100%知道此代码...:)
But im not 100% sure about this code... :)
这篇关于如何加载一些HTML并追加到< body>用jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文