If you want all elements inside the body tag, not just first level children, you can simply use getElementsByTagName()
with a wildcard:
var elems = document.body.getElementsByTagName("*");
More Related Contents:
- How to store objects in HTML5 localStorage
- Invoking JavaScript code in an iframe from the parent page
- Capture HTML Canvas as gif/jpg/png/pdf?
- Adjust width and height of iframe to fit with content in it
- How to get numeric value from a prompt box? [duplicate]
- Good tutorial for using HTML5 History API (Pushstate?) [closed]
- How to set value of input text using jQuery
- How do I get the information from a meta tag with JavaScript?
- getElementById() returns null even though the element exists [duplicate]
- How to display JavaScript variables in a HTML page without document.write
- script tag create with innerHTML of a div doesn’t work
- javascript – shuffle HTML list element order
- Form Submit Execute JavaScript Best Practice? [closed]
- Text blinking jQuery
- How to mute all sound in a page with JS?
- How to resize html canvas element?
- Opening new window in HTML for target=”_blank”
- Nesting quotes in JavaScript/HTML
- How to display div after click the button in Javascript? [duplicate]
- Looping through files for FileReader, output always contains last value from loop
- HTML5 callbacks?
- JavaScript: Get image dimensions
- Sorting a list by data-attribute
- How to trigger CSS “hover state” using Javascript? [duplicate]
- Check if a file exists locally using JavaScript only
- Is there an equivalent of canvas’s toDataURL method for SVG? [closed]
- Gaussian Blur onHover Using jQuery
- Add Whatsapp function to website, like sms, tel
- How to keep elements non-refreshed
- How can I force input to uppercase in an ASP.NET textbox?