开发者

How do I select all elements inside the <body> tag for a jquery .load call?

开发者 https://www.devze.com 2023-02-09 08:58 出处:网络
When using .load() I know I can select a spe开发者_StackOverflow社区cific element out of the called file by using an ID, such as:

When using .load() I know I can select a spe开发者_StackOverflow社区cific element out of the called file by using an ID, such as:

$('#replacediv').load('loadme.htm #loaddiv');

What I would like is a selector that will get everything inside of the BODY tag, without having to put a div around all that content.

$('#replacediv').load('loadme.htm');

This doesn't work, for example:

$('#replacediv').load('loadme.htm body');

Thanks, Brian


Can you not just give your body tag an id or class and then use that?


edited: My bad, your example should work. You probably have a problem with the file path or its content.


maybe this should work

var allelement = $(document.body.getElementsByTagName("*"));
0

精彩评论

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