How to select all the elements inside the <body> tag to call jquery.load?

When using .load() I know that I can select a specific element from the called file using an identifier, for example:

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

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

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

This does not work, for example:

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

Thanks Brian

+4
source share
3 answers

Can you not just tell the body your identifier or class, and then use it?

+2
source

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

0
source

maybe this should work

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

Source: https://habr.com/ru/post/1338634/


All Articles