How can I check if an element has a content (except whitespaces) then append a new element if the element has no content? Just pure javascript if possible.
<div id="container">
</div>
if the container has only whitespaces then:
<div id="container">EMPTY</div>
VS
<div id="container">I am not empty</div>
if the container has content (no need to append EMPTY):
<div id="container">I am not empty</div>