开发者

jQuery load() alternative

开发者 https://www.devze.com 2023-02-11 02:21 出处:网络
I use a script to include HTML bits from an external file using load(). $(\'#includeHTML\').load(\'includeHTML.html #con开发者_运维知识库tainerID\');

I use a script to include HTML bits from an external file using load().

$('#includeHTML').load('includeHTML.html #con开发者_运维知识库tainerID');

If I decide to include these HTML div in the same file instead of external file, what should I use?

Thanks.


$('#includeHTML').html($('#containerID').html());

...but why is that even necessary? If you're going to put the snippets of HTML into the same file, put them where they belong. Then you won't have to use any JavaScript.


I think you need $('#containerID').clone().appendTo('$includeId')

0

精彩评论

暂无评论...
验证码 换一张
取 消