What is the reason I don't have to include the jQuery library. To use the method. I want to append an element after the h1
.
The h1
is in between other child elements.
const contentDivH1 = document.getElementById('content').children[2];
const svgElement = document.createElement('svg');
iife to append after h1
the svg
element
(() => contentDivH1.after(svgElement))()
It worked but why?
thanks to @Quentin: .after()
is part of the DOM API, not native JS.