开发者

jQuery load() alternative

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜