How do I select all elements inside the <body> tag for a jquery .load call?
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("*"));
精彩评论