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')
精彩评论