I have 2 paragraph and in between, I'll call a function. This function is to create a new div between the paragraph.
<div id="container">
<p>lorem ipsum</p>
<script>createDiv()</script>
<p>lorem ipsum</p>
<p>lorem ipsum</p>
</div>
I've seen append()
, but it need a target to append. I want to add the div automatically every time I call the function.
Also, document.write()
but this will clear the paragraph.
There's multiple paragraph on the same page, and I can't add id or class to these paragraph. I don't have control over them.