I need to use JavaScript, without jQuery, to determine whether an element is empty or not. If the element is empty, the code should return true; if it contains content, it should return false."
For instance, let's consider this div that needs to be checked for emptiness:
<div id="foo">
</div>
Since this div is empty, the code should return true. However, in the scenario below:
<div id="cats">
<h1>Cats are awesome!</h1>
</div>
The code should return false because this div has content.
EDIT: What I actually need to check is whether the div contains any children. The solution can be found in the comments section.