This is not a duplicate of jQuery - add element after text, because the element where I want to insert has more elements besides the text, using append places my element in the wrong place.
Suppose I have many elements like:
<li class="target-line">
<blablabla></blablabla>
<div class="known">...</div>
Element's text
<...variable element, can't query it to use .before()></...>
<more elements/>
</li>
And I want to insert a complex element newElement
(not one that I can just write as a string) right after the Element's text
.
How can I do it? Answers without Jquery are ok as long as they're simple.