I am looking for a way how I can insert things before an element in plain javascript.
I have a footer element:
//html
<footer>
...
</footer>
// js
var footer = document.querySelector('footer')
and I want to add this string containing html before it:
var string = "<div class='sun'><p>hi and more things</p>...</div>"
In jQuery I'd simply do this:
$(footer).before(string)
But how I can do it in plain javascript? How to convert the string to NODE and then display?